|
From: Arndt M. <amu...@is...> - 2005-08-11 15:09:26
|
Matthew J Fletcher wrote:
>Hi
>
>valgrind 3.0.0 (as did 2.4) reports the following,..
>
>'Conditional jump or move depends on uninitialised value(s)'
>
>for the following sample code, the line 'if ( *(Deflate + 8 ) == ';' )'
>is the line for which the warning is given.
>
>int main(void)
>{
> char *Deflate = strstr( "gzip,deflate", "deflate" );
> if ( !Deflate )
> return 0;
>
> if ( *(Deflate + 8 ) == ';' )
> return 1;
>}
>
>why ?, '\0' does not equal uninitialised does it ?
>
>
Looks like an off-by-one to me.
The String starts with Deflate[0] == 'd', therefore Deflate[7] == 0.
Deflate[8] is the next position after the trailing zero.
Greetings,
Arndt
|