]> www.wagner.pp.ru Git - oss/catdoc.git/blobdiff - src/fileutil.c
Fix vulnerability in rtfread.c:getNumber. Rewrote null pointer check in fileutils...
[oss/catdoc.git] / src / fileutil.c
index 657b02252375cf2a9caa7c7b1bccd801c28767a3..ce616c2ea112d170894a7d95dbf7679d00437e1c 100644 (file)
@@ -104,10 +104,14 @@ int check_charset(char **filename,const char *charset) {
                return 1;
        }   
        tmppath=find_file(stradd(charset,CHARSET_EXT),charset_path);
                return 1;
        }   
        tmppath=find_file(stradd(charset,CHARSET_EXT),charset_path);
-       if (tmppath&& *tmppath) {
-               *filename=strdup(charset);
-               free(tmppath);
-               return 1;
+       /* Some compilers evalate both arguments of && before
+          applying, so let's not use && as in the shell */
+       if (tmppath) {
+           if (*tmppath) {
+                       *filename=strdup(charset);
+                       free(tmppath);
+                       return 1;
+               }
        }
        return 0;
 }
        }
        return 0;
 }