[Olsr-dev] First batch of Coverity fixes

Henning Rogge (spam-protected)
Fri Jul 12 14:04:31 CEST 2013


Coverity just announced some new "problems" with the Olsr.org code.

I would like to hear your opinions on this patchset:


diff --git a/src/cfgparser/olsrd_conf.c b/src/cfgparser/olsrd_conf.c
index c1f6652..3fd1966 100644
--- a/src/cfgparser/olsrd_conf.c
+++ b/src/cfgparser/olsrd_conf.c
@@ -767,11 +767,6 @@ olsrd_sanity_check_cnf(struct olsrd_config *cnf)
        return -1;
      }

-    if (io == NULL) {
-      fprintf(stderr, "Interface %s has no configuration!\n", in->name);
-      return -1;
-    }
-
      /*merge lqmults*/
      if (mult_orig!=NULL) {
        io->orig_lq_mult_cnt=1;
diff --git a/src/olsr_cookie.c b/src/olsr_cookie.c
index dfd618a..feff0ae 100644
--- a/src/olsr_cookie.c
+++ b/src/olsr_cookie.c
@@ -67,7 +67,12 @@ olsr_alloc_cookie(const char *cookie_name, 
olsr_cookie_type cookie_type)
      }
    }

-  assert(ci_index < COOKIE_ID_MAX);     /* increase COOKIE_ID_MAX */
+  if (ci_index == COOKIE_ID_MAX) {
+    assert(false);     /* increase COOKIE_ID_MAX */
+
+    /* assert will not be there when compiled without debug information */
+    exit(1);
+  }



Henning Rogge

-- 
Diplom-Informatiker Henning Rogge , Fraunhofer-Institut für
Kommunikation, Informationsverarbeitung und Ergonomie FKIE
Kommunikationssysteme (KOM)
Fraunhofer Straße 20, 53343 Wachtberg, Germany
Telefon +49 228 9435-961,   Fax +49 228 9435 685
mailto:(spam-protected) http://www.fkie.fraunhofer.de

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6169 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20130712/9ae66e3b/attachment.bin>


More information about the Olsr-dev mailing list