Re: Patch: fix null pointer access (spotted by Coverity)

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

 



The following patch prevent potential null pointer access in fc-cat
(Coverity defect #1804).

-- 
Frederic Crozat <fcrozat@xxxxxxxxxxxx>
Mandriva
Index: ChangeLog
===================================================================
RCS file: /cvs/fontconfig/fontconfig/ChangeLog,v
retrieving revision 1.109.2.192
diff -u -p -r1.109.2.192 ChangeLog
--- ChangeLog	11 Apr 2006 05:08:26 -0000	1.109.2.192
+++ ChangeLog	11 Apr 2006 12:43:07 -0000
@@ -1,3 +1,8 @@
+2006-04-11  Frederic Crozat  <fcrozat@xxxxxxxxxxxx>
+
+	* fc-cat/fc-cat.c: (FcCacheFileRead):
+	Fix potential null pointer access (Coverity defect #1804).
+
 2006-04-11  Behdad Esfahbod  <behdad@xxxxxxxxxxxxxx>
 	reviewed by: plam
 
Index: fc-cat/fc-cat.c
===================================================================
RCS file: /cvs/fontconfig/fontconfig/fc-cat/Attic/fc-cat.c,v
retrieving revision 1.1.2.18
diff -u -p -r1.1.2.18 fc-cat.c
--- fc-cat/fc-cat.c	7 Apr 2006 04:42:32 -0000	1.1.2.18
+++ fc-cat/fc-cat.c	11 Apr 2006 12:43:07 -0000
@@ -243,6 +243,7 @@
     off_t current_arch_start = 0;
     char subdirName[FC_MAX_FILE_LEN + 1 + 12 + 1];
     static char name_buf[8192], *dir;
+    char *buf;
     FcChar8 * ls;
 
     if (!cache_file)
@@ -265,7 +266,8 @@
     if (current_arch_start < 0)
         goto bail1;
 
-    while (strlen(FcCacheReadString (fd, subdirName, sizeof (subdirName))) > 0)
+    while ((buf = FcCacheReadString (fd, subdirName, sizeof (subdirName))) 
+           && *buf)
         FcStrSetAdd (dirs, (FcChar8 *)subdirName);
 
     dir = strdup(name_buf);
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig

[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux