I'm worried about dillo2/src/url.c, line 361: p = str1 = dNew(char, strlen(url_str)); /* Yes, enough memory! */ The code after this line copies url_str to str1 , skipping illegal characters. It seems to me it should allocate one more character for the terminating null character. Does the comment "enough memory" mean that I am missing something, or is it talking about some other issue? Regards, Jeremy Henty
Hi, On Sun, Jan 27, 2008 at 05:11:30PM +0000, Jeremy Henty wrote:
I'm worried about dillo2/src/url.c, line 361:
p = str1 = dNew(char, strlen(url_str)); /* Yes, enough memory! */
The code after this line copies url_str to str1 , skipping illegal characters. It seems to me it should allocate one more character for the terminating null character. Does the comment "enough memory" mean that I am missing something, or is it talking about some other issue?
Yeah, looks scary! But this code path is only reached if there is at least one illegal character, so at least one char will be skipped and then there is enough room for the \0. Regards, Johannes
Regards,
Jeremy Henty
_______________________________________________ Dillo-dev mailing list Dillo-dev@dillo.org http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
On Sun, Jan 27, 2008 at 06:17:21PM +0100, Johannes Hofmann wrote:
Hi,
On Sun, Jan 27, 2008 at 05:11:30PM +0000, Jeremy Henty wrote:
I'm worried about dillo2/src/url.c, line 361:
p = str1 = dNew(char, strlen(url_str)); /* Yes, enough memory! */
The code after this line copies url_str to str1 , skipping illegal characters. It seems to me it should allocate one more character for the terminating null character. Does the comment "enough memory" mean that I am missing something, or is it talking about some other issue?
Yeah, looks scary! But this code path is only reached if there is at least one illegal character, so at least one char will be skipped and then there is enough room for the \0.
OK, I get it! Thanks. I thought I must be missing something since otherwise Dillo would have segfaulted everytime it created a URL, which obviously does not happen. Regards, Jeremy Henty
participants (2)
-
Johannes.Hofmann@gmx.de
-
onepoint@starurchin.org