change log for rtems (2011-03-15)
gedare at gwmail.gwu.edu
Tue Mar 15 16:23:41 UTC 2011
On Tue, Mar 15, 2011 at 12:01 PM, Peter Dufault <dufault at hda.com> wrote:
> On Mar 15, 2011, at 11:34 , Joel Sherrill wrote:
>>> IMO this patch is simply plain wrong and should be reverted.
>> OK... anyone else have an opinion?
> The comment says 256 and the code says 156.
> I wouldn't make the change to shut coverity up.
> I'd add a comment "Adjust for number of spaces needed" where you adjust len with "len += argc - 2 - 1".
> I'd take out the "if (arg < (argc - 1)) " test and set *(p-1) = 0 after exiting the loop to remove one branch.
> I'd change the printfs to fprintf(stderr.
> I wouldn't initialize "env" and "string" to NULL at the top, doing so defeats detecting "used before set" checks.
I agree with the above suggestions, and:
* Don't need to switch to strnlen, the worst that can happen is
failure to malloc the requested space (in case of malicious/buggy
* Don't need to switch to strncpy, because the size of the buffer is
known safe (you malloc'ed enough space for the strings. Of course,
this only works if you use strlen.
> Peter Dufault
> HD Associates, Inc. Software and System Engineering
> rtems-vc mailing list
> rtems-vc at rtems.org
More information about the vc