]> err.no Git - dpkg/commitdiff
Make sure newly allocated filter struct is cleared
authorTollef Fog Heen <tfheen@err.no>
Thu, 27 Dec 2007 06:47:03 +0000 (07:47 +0100)
committerTollef Fog Heen <tfheen@err.no>
Thu, 27 Dec 2007 06:47:03 +0000 (07:47 +0100)
To avoid memory corruption, make sure to clear out the new filter
struct when it is allocated.

lib/myopt.c

index 5373defed3e9428463a168f6ea8586ddec86a37e..6defe60ab1543d991f7c1a77d2aeec9b12f59f4b 100644 (file)
@@ -190,6 +190,7 @@ void loadfilter(char *fn) {
     if (!filter) {
       ohshite(_("Error allocating memory for filter entry"));
     }
+    memset(filter, 0, sizeof(struct filterlist));
 
     if (linebuf[0] == '#' || linebuf[0] == '\n') {
       continue;
@@ -217,7 +218,6 @@ void loadfilter(char *fn) {
     if (! filters) {
       filters = filter;
       filtertail = filter;
-      filter->next = NULL;
     } else {
       filtertail->next = filter;
       filtertail = filtertail->next;