]> granicus.if.org Git - php/commitdiff
fix access to non initialized memory (check valgrind reports on http://gcov.php.net)
authorNuno Lopes <nlopess@php.net>
Fri, 2 Mar 2007 18:41:25 +0000 (18:41 +0000)
committerNuno Lopes <nlopess@php.net>
Fri, 2 Mar 2007 18:41:25 +0000 (18:41 +0000)
ext/gd/libgd/gd_gif_in.c

index a770e168937320627ffaacb3148e2e8b0a38b49e..a5725e11153eacaa8b80f11a2c19b786d73f2bc3 100644 (file)
@@ -121,7 +121,6 @@ gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr fd) /* {{{ */
        int             bitPixel;
        int            i;
        /*1.4//int             imageCount = 0; */
-       char            version[4];
 
        gdImagePtr im = 0;
        ZeroDataBlock = FALSE;
@@ -133,9 +132,8 @@ gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr fd) /* {{{ */
        if (strncmp((char *)buf,"GIF",3) != 0) {
                return 0;
        }
-       strlcpy(version, (char *)buf + 3, sizeof(version));
 
-       if ((strcmp(version, "87a") != 0) && (strcmp(version, "89a") != 0)) {
+       if ((strncmp((char*)buf+3, "87a", 3) != 0) && (strncmp((char*)buf+3, "89a", 3) != 0)) {
                return 0;
        }
        if (! ReadOK(fd,buf,7)) {