svn commit: trunk/busybox/networking/libiproute

vda at busybox.net vda at busybox.net
Mon Jun 4 21:03:53 UTC 2007


Author: vda
Date: 2007-06-04 14:03:51 -0700 (Mon, 04 Jun 2007)
New Revision: 18742

Log:
snprintf(... "%s"...) => safe_strncpy



Modified:
   trunk/busybox/networking/libiproute/utils.c


Changeset:
Modified: trunk/busybox/networking/libiproute/utils.c
===================================================================
--- trunk/busybox/networking/libiproute/utils.c	2007-06-04 18:23:59 UTC (rev 18741)
+++ trunk/busybox/networking/libiproute/utils.c	2007-06-04 21:03:51 UTC (rev 18742)
@@ -316,9 +316,12 @@
 			default:;
 			}
 		}
-		if (len > 0 && (h_ent = gethostbyaddr(addr, len, af)) != NULL) {
-			snprintf(buf, buflen - 1, "%s", h_ent->h_name);
-			return buf;
+		if (len > 0) {
+			h_ent = gethostbyaddr(addr, len, af);
+			if (h_ent != NULL) {
+				safe_strncpy(buf, h_ent->h_name, buflen);
+				return buf;
+			}
 		}
 	}
 #endif




More information about the busybox-cvs mailing list