Coverity CID 400011 - Derefence NULL return value
authorNelson Ferreira <nelson.ferreira@ieee.org>
Fri, 15 Jun 2012 15:14:54 +0000 (11:14 -0400)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Fri, 15 Jun 2012 15:14:54 +0000 (11:14 -0400)
* src/doc.c (Fsnarf_documentation): Verify that indeed end is not
NULL. If it is NULL then report a file format error.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/doc.c

index 1ebb10d..d7b2c5f 100644 (file)
--- a/src/doc.c
+++ b/src/doc.c
@@ -748,6 +748,12 @@ when doc strings are referred to in the dumped Emacs.
                /* p points to ^_Ffunctionname\n or ^_Vvarname\n.  */
                if (p != end) {
                        end = strchr(p, '\n');
+                        if (end == NULL) {
+                                report_file_error("Bad format in file",
+                                                  Fcons(build_string(name), Qnil)); 
+                                close(fd);
+                                return Qnil;
+                        }
                        sym =
                            oblookup(Vobarray, (Bufbyte *) p + 2, end - p - 2);
                        if (SYMBOLP(sym)) {