Fix crash when no netname is specified.
[tinc] / src / tincctl.c
index f547639..ca354bc 100644 (file)
@@ -192,7 +192,7 @@ static bool parse_options(int argc, char **argv) {
 
         /* netname "." is special: a "top-level name" */
 
-        if(!strcmp(netname, ".")) {
+        if(netname && !strcmp(netname, ".")) {
                 free(netname);
                 netname = NULL;
         }
@@ -1194,7 +1194,7 @@ static int cmd_config(int argc, char *argv[]) {
 
        while(fgets(buf1, sizeof buf1, f)) {
                buf1[sizeof buf1 - 1] = 0;
-               strcpy(buf2, buf1);
+               strncpy(buf2, buf1, sizeof buf2);
 
                // Parse line in a simple way
                char *bvalue;