Revision: 65182
          http://sourceforge.net/p/brlcad/code/65182
Author:   starseeker
Date:     2015-06-04 20:01:58 +0000 (Thu, 04 Jun 2015)
Log Message:
-----------
Make null termination explicit for clarity.

Modified Paths:
--------------
    brlcad/trunk/src/libbu/opt.c

Modified: brlcad/trunk/src/libbu/opt.c
===================================================================
--- brlcad/trunk/src/libbu/opt.c        2015-06-04 19:50:49 UTC (rev 65181)
+++ brlcad/trunk/src/libbu/opt.c        2015-06-04 20:01:58 UTC (rev 65182)
@@ -452,10 +452,12 @@
     int ac;
     if (!argv || !tbl || BU_PTBL_LEN(tbl) == 0) return 0;
     ac = BU_PTBL_LEN(tbl);
-    av = (const char **)bu_calloc(ac, sizeof(char *), "argv");
+    av = (const char **)bu_calloc(ac + 1, sizeof(char *), "argv");
     for (i = 0; i < ac; i++) {
        av[i] = (const char *)BU_PTBL_GET(tbl, i);
     }
+    /* Make it explicitly clear that the array is NULL terminated */
+    av[ac] = NULL;
     (*argv) = av;
     return ac;
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to