From 22fa51dbf5f7fc1691f58e57e4048a11ea7fd9c4 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 5 Aug 1994 00:24:28 +0000 Subject: [PATCH] changed bufs from MAXPATHLEN to MAXPATHLEN+1 --- sudo_realpath.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sudo_realpath.c b/sudo_realpath.c index 273f3e21c..e4d41516c 100644 --- a/sudo_realpath.c +++ b/sudo_realpath.c @@ -94,7 +94,7 @@ char * sudo_realpath(old, new) const char * old; char * new; { - char buf[MAXPATHLEN]; /* generic path buffer */ + char buf[MAXPATHLEN+1]; /* generic path buffer */ struct stat statbuf; /* for lstat() */ char * temp; /* temporary ptr */ int len; /* length parameter */ @@ -103,8 +103,8 @@ char * sudo_realpath(old, new) if (old == NULL || old[0] == NULL) return(NULL); - new[MAXPATHLEN - 1] = '\0'; - (void) strncpy(new, old, MAXPATHLEN - 1); + new[MAXPATHLEN] = '\0'; + (void) strncpy(new, old, MAXPATHLEN); /* we need to be root for this section */ be_root(); -- 2.50.0