-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi,

On Sat, 04 May 2013 18:11:28 +0200, Ralf Jung <p...@ralfj.de> wrote:
> > Thanks for the bug report; this also affects ffset. I've adapted
> > your patch slightly, using PATH_MAX instead of 256. This also
> > addresses the point you raise in your follow-up email about the
> > terminating null, since PATH_MAX includes that. It's incompatible
> > with the Hurd but the joystick tools are Linux-specific anyway...
> Great, thanks for the quick reaction.
> I don't see however how using PATH_MAX alone can fix the NULL issue.
> The user could still pass the program a filename longer than PATH_MAX
> (though it will not be a valid filename), in which case strncpy will
> overwrite the filename buffer with the first PATH_MAX characters of
> the user input. The buffer is now not NULL-terminated, which can lead
> to interesting behaviour in the following.
> Or do I miss anything?

Doh! Indeed, there are no guarantees about argv...

> Also, PATH_MAX does not seem to always hold what it promises, see
> http://insanecoding.blogspot.de/2007/11/pathmax-simply-isnt.html

Yes, but I'm working on the assumption that people want to actually use their
devices; so paths larger than 4096 are unlikely. As long as the programs
don't suffer from buffer overflows everything should be OK!

The sensible solution would be to malloc() whatever's necessary, that would
solve everything; I might just do that instead...

Regards,

Stephen
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBCAAGBQJRhT8mAAoJEHWXeKmja0lPVAYP/jDuK8GvNdEv7ABPa64EwGIr
pGRBePpv63+p0JlMjIRWjRWlNTXoxQDZvsuZxFQFEPd7mDP3cZ+Lq3H08GQLh2x+
AsOfx8LsGkVo/BaCCKitZhoewCjEirYsMbhgTfx2of0jz1b17YjODc5hO565imJk
ZUb/rz1FUvzbEBqUfaCHz/lgATJCxWV4mQz8uyxQP7H1OWiM7upcAqHG2NRYUFCA
3+kRF8J/0A+ZTYhWHmEvHE9uqCk+mAXdXuMVtdOTpFdD0U/4ty1/gOEKDQUSMfNH
mzcGotayQHl8OnHpbSWvDQp2sHSSh8WpTnOOf2ZSVd8EVuJhT0tBG/yVsoRQ6Yb1
e0JQvQTB6YXn5pKL6gSNsQd5LPqejWcBScg6QSoQ0URbHVTpPnT44pwyFXL169wB
OEhdu48S3UX3rmvjIU2VNk/3tjjl6IPzV322++iT6hhH7INLIKTh5vbylJiqAcJr
hny+81CP+ckUdgMBHRi3VQeOCJtwGigH2Zjy2SXmnqBI1CC8if8/qGv/Sxk895xu
Lv0nA/lheC5GEFi53uWYtPdC8/B0gIP+Ssf+ETM6AnOxH9q724eNFGqS2y/qMjAH
DrWiwGbvk4YwkE2AOuSbWc7wAkmfOYnXz2M+zT56p2paCTN3NJRmFSYdu+Onm1Bo
Ms1WcyYbuMwn2S/XztSP
=p2Tj
-----END PGP SIGNATURE-----

Reply via email to