]> git.ipfire.org Git - thirdparty/dhcp.git/blobdiff - dhcpctl/omshell.c
- Silence benign static analysis warnings.
[thirdparty/dhcp.git] / dhcpctl / omshell.c
index bb489d8456dc5cd65ca4ccb9222d534ed09efc95..22506eec9cd941d75f2b8f31b3eafa190fe4d9aa 100644 (file)
@@ -3,7 +3,7 @@
    Examine and modify omapi objects. */
 
 /*
- * Copyright (c) 2009-2011 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2009-2011,2013 by Internet Systems Consortium, Inc. ("ISC")
  * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC")
  * Copyright (c) 2001-2003 by Internet Software Consortium
  *
@@ -466,8 +466,12 @@ main(int argc, char **argv) {
                            break;
                    }
 
-                   s1[0] = '\0';
-                   strncat (s1, val, sizeof(s1)-1);
+#ifdef HAVE_STRLCPY
+                   strlcpy (s1, val, sizeof(s1));
+#else
+                   s1[0] = 0;
+                   strncat (s1, val, sizeof(s1)-strlen(s1)-1);
+#endif
                    
                    token = next_token (&val, (unsigned *)0, cfile);
                    if (token != EQUAL)
@@ -570,8 +574,12 @@ main(int argc, char **argv) {
                            break;
                    }
 
-                   s1[0] = '\0';
-                   strncat (s1, val, sizeof(s1)-1);
+#if HAVE_STRLCPY
+                   strlcpy (s1, val, sizeof(s1));
+#else
+                   s1[0] = 0;
+                   strncat (s1, val, sizeof(s1)-strlen(s1)-1);
+#endif
                    
                    token = next_token (&val, (unsigned *)0, cfile);
                    if (token != END_OF_FILE && token != EOL)