INN commit: trunk (4 files)

INN Commit rra at isc.org
Tue May 5 17:23:26 UTC 2015


    Date: Tuesday, May 5, 2015 @ 10:23:25
  Author: iulius
Revision: 9851

Initialize ARTHANDLE objects before passing by value

Uninitialised fields have indeterminate values (6.2.4#5); this
includes trap representations (3.17.2).  The access to such fields
in the subsequent function calls that pass the ARTHANDLE has
undefined behaviour (s6.2.6.1).

The fix relies on 6.7.8#21.

All references to C99.

Thanks to Richard Kettlewell for the patch.

Modified:
  trunk/contrib/respool.c
  trunk/frontends/sm.c
  trunk/innd/art.c
  trunk/tests/overview/xref-t.c

-------------------------+
 contrib/respool.c       |    2 +-
 frontends/sm.c          |    2 +-
 innd/art.c              |    2 +-
 tests/overview/xref-t.c |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

Modified: contrib/respool.c
===================================================================
--- contrib/respool.c	2015-05-03 15:25:53 UTC (rev 9850)
+++ contrib/respool.c	2015-05-05 17:23:25 UTC (rev 9851)
@@ -26,7 +26,7 @@
     char *tokenptr;
     int len;
     ARTHANDLE *art;
-    ARTHANDLE newart;
+    ARTHANDLE newart = { 0 };
     TOKEN token, newtoken;
     char *arttmp;
 

Modified: frontends/sm.c
===================================================================
--- frontends/sm.c	2015-05-03 15:25:53 UTC (rev 9850)
+++ frontends/sm.c	2015-05-05 17:23:25 UTC (rev 9851)
@@ -58,7 +58,7 @@
     struct buffer *article;
     size_t size;
     char *text, *start, *end;
-    ARTHANDLE handle;
+    ARTHANDLE handle = { 0 };
     TOKEN token;
 
     /* Build the basic article handle. */

Modified: innd/art.c
===================================================================
--- innd/art.c	2015-05-03 15:25:53 UTC (rev 9850)
+++ innd/art.c	2015-05-05 17:23:25 UTC (rev 9851)
@@ -445,7 +445,7 @@
   ARTDATA	*data = &cp->Data;
   HDRCONTENT	*hc = data->HdrContent;
   const char	*p;
-  ARTHANDLE	arth;
+  ARTHANDLE	arth = { 0 };
   int		i, j, iovcnt = 0;
   long		headersize = 0;
   TOKEN		result;

Modified: tests/overview/xref-t.c
===================================================================
--- tests/overview/xref-t.c	2015-05-03 15:25:53 UTC (rev 9850)
+++ tests/overview/xref-t.c	2015-05-05 17:23:25 UTC (rev 9851)
@@ -184,7 +184,7 @@
     bool value;
     char *article, *wire;
     size_t size;
-    ARTHANDLE handle;
+    ARTHANDLE handle = { 0 };
     TOKEN token;
 
     if (access("../data/overview/xref", F_OK) == 0)



More information about the inn-committers mailing list