diff options
author | kris <kris@FreeBSD.org> | 2000-08-04 09:23:07 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2000-08-04 09:23:07 +0000 |
commit | 4e7ee5ff5d4144abe12c062c75ba23a2c17fd311 (patch) | |
tree | 163ce040a0c7839d20a50e02bcc7722d59af045d /lib | |
parent | ab028d4b7f92c65ee709075a7cd084c5ecce7dd8 (diff) | |
download | FreeBSD-src-4e7ee5ff5d4144abe12c062c75ba23a2c17fd311.zip FreeBSD-src-4e7ee5ff5d4144abe12c062c75ba23a2c17fd311.tar.gz |
Limit the amount of data copied to the error buffer to _POSIX2_LINE_MAX.
This is the documented size which the user-provided buffer must be.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libkvm/kvm.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index a4818b6..d4a7645 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -244,7 +244,7 @@ failed: * Copy out the error if doing sane error semantics. */ if (errout != 0) - strcpy(errout, kd->errbuf); + strlcpy(errout, kd->errbuf, _POSIX2_LINE_MAX); (void)kvm_close(kd); return (0); } @@ -260,7 +260,7 @@ kvm_openfiles(uf, mf, sf, flag, errout) register kvm_t *kd; if ((kd = malloc(sizeof(*kd))) == NULL) { - (void)strcpy(errout, strerror(errno)); + (void)strlcpy(errout, strerror(errno), _POSIX2_LINE_MAX); return (0); } memset(kd, 0, sizeof(*kd)); |