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.
This commit is contained in:
Kris Kennaway 2000-08-04 09:23:07 +00:00
parent 3378439583
commit ba3c0383aa

View File

@ -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));