Add in ifconfig and route
[oweals/busybox.git] / utility.c
index f3c184e7308f6d91dcfe2622843814f6db4eb809..368dfc5feb59ef1a007df8d95cb5a2c81efd32ed 100644 (file)
--- a/utility.c
+++ b/utility.c
@@ -1377,6 +1377,14 @@ extern char * xstrndup (const char *s, int n) {
 }
 #endif
 
+#if defined BB_IFCONFIG || defined BB_ROUTE
+/* Like strncpy but make sure the resulting string is always 0 terminated. */  
+extern char * safe_strncpy(char *dst, const char *src, size_t size)
+{   
+       dst[size-1] = '\0';
+       return strncpy(dst, src, size-1);   
+}
+#endif
 
 #if (__GLIBC__ < 2) && (defined BB_SYSLOGD || defined BB_INIT)
 extern int vdprintf(int d, const char *format, va_list ap)