From 5a16f354fd03f291a3606849fd68ee41bc9e0092 Mon Sep 17 00:00:00 2001 From: mbr Date: Mon, 27 Jan 2003 22:36:53 +0000 Subject: Make sure we don't look before the beginning of the string. NetBSD Rev 1.5 Reviewed by: phk Obtained from: NetBSD --- lib/libc/rpc/getnetpath.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/rpc/getnetpath.c b/lib/libc/rpc/getnetpath.c index 087cb30..474d3e0 100644 --- a/lib/libc/rpc/getnetpath.c +++ b/lib/libc/rpc/getnetpath.c @@ -249,9 +249,9 @@ int token; /* char to parse string for */ /* * did find a token, but it might be escaped. */ - if (cp[-1] == '\\') { + if ((cp > npp) && (cp[-1] == '\\')) { /* if slash was also escaped, carry on, otherwise find next token */ - if (cp[-2] != '\\') { + if ((cp > npp + 1) && (cp[-2] != '\\')) { /* shift r-o-s onto the escaped token */ strcpy(&cp[-1], cp); /* XXX: overlapping string copy */ /* -- cgit v1.1