DragonFly BSD
DragonFly submit List (threaded) for 2005-05
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

[PATCH] another bug(typo?) in lib/libatm


From: Sepherosa Ziehau <sepherosa@xxxxxxxxx>
Date: Wed, 4 May 2005 13:58:11 +0800

gethostbyaddr() expects sizeof(struct in_addr) as the second argument
instead of sizeof(struct in_addr *), although on 32bit machine they
are same.
Please review it.

sephe

-- 
Live Free or Die
Index: atm_addr.c
===================================================================
RCS file: /opt/df_cvs/src/lib/libatm/atm_addr.c,v
retrieving revision 1.3
diff -u -r1.3 atm_addr.c
--- atm_addr.c	23 Sep 2004 21:39:08 -0000	1.3
+++ atm_addr.c	4 May 2005 05:57:26 -0000
@@ -177,6 +177,8 @@
 			 */
 			val = val << 4;
 			val += c_value;
+			if (out_len >= len)
+				return 0;
 			out[out_len] = (u_char) val;
 			out_len++;
 			break;
Index: ip_addr.c
===================================================================
RCS file: /opt/df_cvs/src/lib/libatm/ip_addr.c,v
retrieving revision 1.3
diff -u -r1.3 ip_addr.c
--- ip_addr.c	23 Sep 2004 20:20:59 -0000	1.3
+++ ip_addr.c	4 May 2005 05:57:26 -0000
@@ -146,7 +146,7 @@
 	/*
 	 * Look up name in DNS
 	 */
-	ip_host = gethostbyaddr((char *)addr, sizeof(addr), AF_INET);
+	ip_host = gethostbyaddr((char *)addr, sizeof(*addr), AF_INET);
 	if (ip_host && ip_host->h_name &&
 			strlen(ip_host->h_name)) {
 		/*


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]