summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authormbr <mbr@FreeBSD.org>2003-01-27 22:36:53 +0000
committermbr <mbr@FreeBSD.org>2003-01-27 22:36:53 +0000
commit5a16f354fd03f291a3606849fd68ee41bc9e0092 (patch)
treee898175442a7314108fd11138697a35dfc71e43b /lib/libc
parente61117f9e286eab075f4c66187f4359bfcd365a7 (diff)
downloadFreeBSD-src-5a16f354fd03f291a3606849fd68ee41bc9e0092.zip
FreeBSD-src-5a16f354fd03f291a3606849fd68ee41bc9e0092.tar.gz
Make sure we don't look before the beginning of the string.
NetBSD Rev 1.5 Reviewed by: phk Obtained from: NetBSD
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/rpc/getnetpath.c4
1 files changed, 2 insertions, 2 deletions
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 */
/*
OpenPOWER on IntegriCloud