summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/ns_ntoa.c
diff options
context:
space:
mode:
authormillert <>2003-09-25 21:14:46 +0000
committermillert <>2003-09-25 21:14:46 +0000
commiteb717357116944737cfa779dc09332ab7cbb4f43 (patch)
treef399561ad64caec4c1a33f052e4bb8cf5f3d9c4c /src/lib/libc/net/ns_ntoa.c
parentc6223f04e5580b6affc19d5f7518c523814b7da8 (diff)
downloadopenbsd-eb717357116944737cfa779dc09332ab7cbb4f43.tar.gz
openbsd-eb717357116944737cfa779dc09332ab7cbb4f43.tar.bz2
openbsd-eb717357116944737cfa779dc09332ab7cbb4f43.zip
Do check for current pointer vs. buffer end before touching any
elements in the buffer. Fixes an out of bounds access. From aaron@; OK deraadt@
Diffstat (limited to 'src/lib/libc/net/ns_ntoa.c')
-rw-r--r--src/lib/libc/net/ns_ntoa.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libc/net/ns_ntoa.c b/src/lib/libc/net/ns_ntoa.c
index 019e8b0a59..fd67e459da 100644
--- a/src/lib/libc/net/ns_ntoa.c
+++ b/src/lib/libc/net/ns_ntoa.c
@@ -28,7 +28,7 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char rcsid[] = "$OpenBSD: ns_ntoa.c,v 1.12 2003/06/02 20:18:35 millert Exp $"; 31static char rcsid[] = "$OpenBSD: ns_ntoa.c,v 1.13 2003/09/25 21:14:46 millert Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <sys/param.h> 34#include <sys/param.h>
@@ -53,7 +53,7 @@ ns_ntoa(struct ns_addr addr)
53 cp = spectHex(obuf); 53 cp = spectHex(obuf);
54 rem = sizeof(obuf) - (cp - obuf); 54 rem = sizeof(obuf) - (cp - obuf);
55 cp2 = cp + 1; 55 cp2 = cp + 1;
56 while (*up==0 && up < uplim) 56 while (up < uplim && *up==0)
57 up++; 57 up++;
58 if (up == uplim) { 58 if (up == uplim) {
59 if (port) { 59 if (port) {