-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 16/12/2014 1:16 p.m., Markus Moeller wrote: > Hi Amos, > > Thank you for the feedback and suggestions. I did some cleanup > using cppcheck too. Regarding the optarg check I was under the > impression that getopt just makes sure optarg is never NULL. Isn't > that the case ?
As I understand it the behaviour where the argument is missing is actualy undefined. May be NULL may be previous optarg value, may be the uninitialized original value. It is called out in Linux man(8) page as NULL, but my tests show that it actually returns the following argv item unconditionally or exits the loop. So given the mess, better safe than sorry. Given the once-off nature of this processing a few extra cycles being certain are no big deal. The string content validation is needed anyway to protect against wrong ordering behaviour being a problem. Amos -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (MingW32) iQEcBAEBAgAGBQJUj/vaAAoJELJo5wb/XPRj+d8H/jyuPP2GkT49x02ZlVyfIID/ 9XPJz6ZDtTJzFspSxjk1XWlLMyHoEuTdz78sjjWZ5DnVKTQ4WmTJihsafllw3Epf g8UrfL/qpqcPVSK+GgdgO5uC83mZOb8oCds1uEX++wMfU6Bpea9p4nIN1nUJI1cA 7A3ir7tKGVNiMeyX+qxW5ezRijrUJ/IqcBMM4AVuLZ+Tagyf9lWomEwYoWSXw6nz mkxjEcj7HH0dkasL9k2OnThivQups4jNvLPQfWO7b4Ksk0LPFbDsQE115IQaKLjF 8p7GSIcscR1FloAv2ATk4ehBkSnuRNM32S/nKmIBdU9vsNEQOAb7dqPvnZBYPKE= =p+28 -----END PGP SIGNATURE----- _______________________________________________ squid-dev mailing list [email protected] http://lists.squid-cache.org/listinfo/squid-dev
