After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 603909 - Unconditionally uses PATH_MAX which is undefined on some OSes
Unconditionally uses PATH_MAX which is undefined on some OSes
Status: RESOLVED FIXED
Product: gnome-games-superseded
Classification: Deprecated
Component: gnobots2
trunk
Other Linux
: Normal normal
: ---
Assigned To: GNOME Games maintainers
GNOME Games maintainers
Depends on:
Blocks:
 
 
Reported: 2009-12-06 16:49 UTC by Emilio Pozuelo Monfort
Modified: 2009-12-17 00:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Stop using PATH_MAX as it's undefined on some OSes (4.28 KB, patch)
2009-12-06 16:49 UTC, Emilio Pozuelo Monfort
none Details | Review

Description Emilio Pozuelo Monfort 2009-12-06 16:49:51 UTC
Created attachment 149202 [details] [review]
Stop using PATH_MAX as it's undefined on some OSes

Hi,

gnobots uses PATH_MAX unconditionally, which is undefined on OSes that don't have a max path limit (e.g. the Hurd).

- In one of the two places, it's used to read a config file (and not a path!). It could cause buffer overflows if PATH_MAX was smaller than the 256 bytes that can be read into the buffer... but anyway that PATH_MAX usage is weird and since there's a 256 hardcoded there I've made the buffer 256 bytes long too.

- The other usage is to return the config name. If the config name was returned unmodified, it could return it directly and there would be no problem, but since it does, a solution is to return a new string that the caller must free (which is what this patch does).
Comment 1 Jason Clinton 2009-12-17 00:01:47 UTC
Fixed on gnome-2-28 and master; thanks!