From e436f61f195c0d379e42d561101575929386af84 Mon Sep 17 00:00:00 2001 From: Nelson Ferreira Date: Fri, 15 Jun 2012 11:14:54 -0400 Subject: [PATCH] Coverity CID 400011 - Derefence NULL return value * 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 --- src/doc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/doc.c b/src/doc.c index 1ebb10d..d7b2c5f 100644 --- 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)) { -- 2.25.1