summaryrefslogtreecommitdiffstats
path: root/lib/libedit/el.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1997-03-23 23:17:22 +0000
committerimp <imp@FreeBSD.org>1997-03-23 23:17:22 +0000
commitc2a7cee0eee6c5ae03b13f08f2778809ed41c44b (patch)
tree0b7456a69dbe79fcbb4626bb14365c951d24a94e /lib/libedit/el.c
parentd16568f14107c2b35c765f6cf514a214d494ae5f (diff)
downloadFreeBSD-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/el.c')
-rw-r--r--lib/libedit/el.c5
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;
}
}
OpenPOWER on IntegriCloud