From: Bruno H. <br...@cl...> - 2018-01-27 10:50:26
|
Hi Sam, > src/pathname.d (my_realpath): Cosmetic change to avoid gcc warning > > "suggest a space before ';' or explicit braces around empty body in 'while' statement". > > By Sam Steingold on 01/22/2018 16:17 > [**View Changes**](https://sourceforge.net/p/clisp/clisp/ci/b83c1201abb01c8dab13de6e3bb70bff35682243/) This part: @@ -186,14 +186,13 @@ if (mypath_ptr < mypath_limit) { *mypath_ptr++ = '/'; } /* first, append a '/' */ /* then the rest: */ while ((mypath_ptr <= mypath_limit) - && (*mypath_ptr = *from_ptr++)) - { mypath_ptr++; } + && (*mypath_ptr++ = *from_ptr++)) ; *mypath_ptr = 0; /* and conclude wit 0 */ } /* this replaces resp. completes the path: */ Is not right. The value of mypath_ptr after the loop matters. Your patch has the effect of terminating mypath with 2 NUL bytes instead of 1 NUL byte. Thus causing a buffer overrun. Bruno |