diff options
Diffstat (limited to 'usr.bin/mg/fileio.c')
-rw-r--r-- | usr.bin/mg/fileio.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c index 75ee6363608..9cc81311d42 100644 --- a/usr.bin/mg/fileio.c +++ b/usr.bin/mg/fileio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fileio.c,v 1.66 2005/12/13 05:40:33 kjell Exp $ */ +/* $OpenBSD: fileio.c,v 1.67 2005/12/20 05:04:28 kjell Exp $ */ /* This file is in the public domain. */ @@ -454,12 +454,13 @@ make_file_list(char *buf) return (NULL); } /* Now we get the prefix of the name the user typed. */ - strlcpy(prefixx, buf, sizeof(prefixx)); + if (strlcpy(prefixx, buf, sizeof(prefixx)) >= sizeof(prefixx)) + return (NULL); cp = strrchr(prefixx, '/'); if (cp == NULL) - prefixx[0] = 0; + prefixx[0] = '\0'; else - cp[1] = 0; + cp[1] = '\0'; preflen = strlen(prefixx); /* cp is the tail of buf that really needs to be compared. */ |