LWN.net Logo

Format string vulnerabilities

Format string vulnerabilities

Posted Feb 3, 2012 12:05 UTC (Fri) by AndreE (subscriber, #60148)
Parent article: Format string vulnerabilities

Why is it neccessary for sudo to call argv[0] in any case? Surely it is rarely if ever given an alias on users' systems


(Log in to post comments)

Format string vulnerabilities

Posted Feb 5, 2012 22:25 UTC (Sun) by k8to (subscriber, #15413) [Link]

It's best practice to use argv0 when generating error messages, so that your message reflects the program that was executed, even if it was renamed.

It's better than expecting that the program's name will always match the compiled-in name.

Sure, you get a new input vector, but that text is in your program anyway, and will be evaluated by some code you didn't write. I'm not convinced this is a real problem. Patterns where you allow program generated text to be used as a format string really should be either not used or very very carefully audited.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds