diff options
author | joerg <joerg@FreeBSD.org> | 1996-08-08 07:58:07 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1996-08-08 07:58:07 +0000 |
commit | e6813668b6f68d3133e83cdd9f60feacdb14fb5d (patch) | |
tree | ea6c8ed1743b76ac3452e08603829e452bbfdec8 | |
parent | 34bc2a4794eb6a67660d5cd0c72310c201d5391a (diff) | |
download | FreeBSD-src-e6813668b6f68d3133e83cdd9f60feacdb14fb5d.zip FreeBSD-src-e6813668b6f68d3133e83cdd9f60feacdb14fb5d.tar.gz |
Fix a potential buffer overflow condition.
Submitted by: Somebody on -hackers, ooops, i've already deleted that mail
-rw-r--r-- | usr.bin/modstat/modstat.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/modstat/modstat.c b/usr.bin/modstat/modstat.c index 956acf4..7184223 100644 --- a/usr.bin/modstat/modstat.c +++ b/usr.bin/modstat/modstat.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: modstat.c,v 1.2 1995/04/18 02:19:17 wpaul Exp $ + * $Id: modstat.c,v 1.3 1995/04/20 05:08:53 wpaul Exp $ */ #include <stdio.h> @@ -72,8 +72,9 @@ dostat(devfd, modnum, modname) { struct lmc_stat sbuf; + sbuf.name[MAXLKMNAME - 1] = '\0'; /* In case strncpy limits the string. */ if (modname != NULL) - strcpy(sbuf.name, modname); + strncpy(sbuf.name, modname, MAXLKMNAME - 1); sbuf.id = modnum; |