changed bufs from MAXPATHLEN to MAXPATHLEN+1

This commit is contained in:
Todd C. Miller
1994-08-05 00:24:28 +00:00
parent a6fe8c86a9
commit 22fa51dbf5

View File

@@ -94,7 +94,7 @@ char * sudo_realpath(old, new)
const char * old; const char * old;
char * new; char * new;
{ {
char buf[MAXPATHLEN]; /* generic path buffer */ char buf[MAXPATHLEN+1]; /* generic path buffer */
struct stat statbuf; /* for lstat() */ struct stat statbuf; /* for lstat() */
char * temp; /* temporary ptr */ char * temp; /* temporary ptr */
int len; /* length parameter */ int len; /* length parameter */
@@ -103,8 +103,8 @@ char * sudo_realpath(old, new)
if (old == NULL || old[0] == NULL) if (old == NULL || old[0] == NULL)
return(NULL); return(NULL);
new[MAXPATHLEN - 1] = '\0'; new[MAXPATHLEN] = '\0';
(void) strncpy(new, old, MAXPATHLEN - 1); (void) strncpy(new, old, MAXPATHLEN);
/* we need to be root for this section */ /* we need to be root for this section */
be_root(); be_root();