From bcd0fcaf0966c546da5043be700587f73174ae25 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 26 Feb 2008 13:57:39 -0500 Subject: [PATCH] If validateascii is passed a string containing only non-zero 7bit values, then the loop with exit with i == len, and the following test will access beyond the end of the array. So add an extra test to fix this. Found by Marcus Meissner . Signed-off-by: NeilBrown Signed-off-by: Steve Dickson --- utils/idmapd/idmapd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c index 355c6e1..6b5971c 100644 --- a/utils/idmapd/idmapd.c +++ b/utils/idmapd/idmapd.c @@ -848,7 +848,7 @@ validateascii(char *string, u_int32_t len) return (-1); } - if (string[i] != '\0') + if ((i >= len) || string[i] != '\0') return (-1); return (i + 1); -- 2.39.2