]> git.karo-electronics.de Git - mdnsd.git/commitdiff
fix warnings and crasher in sdtxt.c
authorSimon Budig <simon@budig.de>
Thu, 22 Jan 2009 22:56:11 +0000 (23:56 +0100)
committerOle Reinhardt <ole.reinhardt@kernelconcepts.de>
Sun, 28 Apr 2013 23:01:47 +0000 (01:01 +0200)
sdtxt.c

diff --git a/sdtxt.c b/sdtxt.c
index 131121c99f017ed704d459a3851d1f29cebcd1d8..8180d14af39e442ad60d4123baac2eb7643f8da0 100644 (file)
--- a/sdtxt.c
+++ b/sdtxt.c
@@ -1,6 +1,6 @@
-#include "sdtxt.h"
-
+#include <stdlib.h>
 #include <string.h>
+#include "sdtxt.h"
 
 // the universe is bound in equal parts by arrogance and altruism, any attempt to alter this would be suicide
 
@@ -23,7 +23,6 @@ void _sd2txt_write(xht h, const char *key, void *val, void *arg)
 {
     unsigned char **txtp = (unsigned char **)arg;
     char *cval = (char*)val;
-    int len;
 
     // copy in lengths, then strings
     **txtp = _sd2txt_len(key,(char*)val);
@@ -74,7 +73,7 @@ xht txt2sd(unsigned char *txt, int len)
             *val = 0;
             val++;
         }
-        xht_store(h, key, strlen(key), val, strlen(val));
+        xht_store(h, key, strlen(key), val, val ? strlen(val) : 0);
     }
     return h;
 }