diff options
author | imp <imp@FreeBSD.org> | 1997-03-23 23:17:22 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1997-03-23 23:17:22 +0000 |
commit | c2a7cee0eee6c5ae03b13f08f2778809ed41c44b (patch) | |
tree | 0b7456a69dbe79fcbb4626bb14365c951d24a94e /lib/libedit | |
parent | d16568f14107c2b35c765f6cf514a214d494ae5f (diff) | |
download | FreeBSD-src-c2a7cee0eee6c5ae03b13f08f2778809ed41c44b.zip FreeBSD-src-c2a7cee0eee6c5ae03b13f08f2778809ed41c44b.tar.gz |
Fix a minor buffer overflow.
Obtained from: BSDi by way of Keith Bostic
Diffstat (limited to 'lib/libedit')
-rw-r--r-- | lib/libedit/el.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/libedit/el.c b/lib/libedit/el.c index 075a053..305a51d 100644 --- a/lib/libedit/el.c +++ b/lib/libedit/el.c @@ -293,9 +293,8 @@ el_source(el, fname) if ((fp = fopen(fname, "r")) == NULL) { if ((ptr = getenv("HOME")) == NULL) return -1; - fname = strncpy(path, ptr, MAXPATHLEN); - (void) strncat(path, elpath, MAXPATHLEN); - path[MAXPATHLEN-1] = '\0'; + (void)snprintf(path, sizeof(path), "%s%s", ptr, elpath); + fname = path; } } |