Re: Bug in g_strjoin



On Sun, 27 Dec 1998, Gilbert Ramirez Jr. wrote:

>     while((s = va_arg(args, char*)))
>       {
> 		  printf("\tstep1: found %s\n", s);
> 		len += separator_len + strlen(s);
>       }
>     va_end(args);
[...]
> 
> int main(void)
> {
> 	char *str = NULL;
> 
> 	str = g_strjoin(".", "tr", "sr");
> 	printf("g: %s\n", str);

Unless I'm missing something, you have not provided a NULL terminator when
you are invoking g_strjoin. The compiler is under no guarantee of
providing an explicit NULL terminator, and this cannot be relied on. If
you look at the definition of the exec* functions, you'll see the
requirement for NULL. (printf and family doesn't need one because the
formatting string governs how many arguments are used.)

-- 
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]