summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2002-04-22 06:15:47 +0000
committermarkus <markus@openbsd.org>2002-04-22 06:15:47 +0000
commitf32fbfe80168e9107013bfed273293ca08bd3c0f (patch)
tree37c04499069128f08de434abdb39481d7be9e48c
parent don't use /bin/cp to copy files. (diff)
downloadwireguard-openbsd-f32fbfe80168e9107013bfed273293ca08bd3c0f.tar.xz
wireguard-openbsd-f32fbfe80168e9107013bfed273293ca08bd3c0f.zip
fix check for overflow
-rw-r--r--usr.bin/ssh/radix.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/ssh/radix.c b/usr.bin/ssh/radix.c
index 94e3dc70eb3..85ca9c32967 100644
--- a/usr.bin/ssh/radix.c
+++ b/usr.bin/ssh/radix.c
@@ -26,7 +26,7 @@
#include "includes.h"
#include "uuencode.h"
-RCSID("$OpenBSD: radix.c,v 1.18 2002/04/20 09:17:19 markus Exp $");
+RCSID("$OpenBSD: radix.c,v 1.19 2002/04/22 06:15:47 markus Exp $");
#ifdef AFS
#include <krb.h>
@@ -76,15 +76,17 @@ creds_to_radix(CREDENTIALS *creds, u_char *buf, size_t buflen)
#define GETSTRING(b, t, tlen) \
do { \
- int i; \
+ int i, found = 0; \
for (i = 0; i < tlen; i++) { \
if (buffer_len(b) == 0) \
goto done; \
t[i] = buffer_get_char(b); \
- if (t[i] == '\0') \
+ if (t[i] == '\0') { \
+ found = 1; \
break; \
+ } \
} \
- if (t[i] != '\0') \
+ if (!found) \
goto done; \
} while(0)