unstr: Check that the input filename fits in the buffer.

This commit is contained in:
nia 2020-04-29 21:00:42 +00:00
parent 5774e6823b
commit 669bbdba3b
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: unstr.c,v 1.14 2012/06/19 05:46:08 dholland Exp $ */
/* $NetBSD: unstr.c,v 1.15 2020/04/29 21:00:42 nia Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\
#if 0
static char sccsid[] = "@(#)unstr.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: unstr.c,v 1.14 2012/06/19 05:46:08 dholland Exp $");
__RCSID("$NetBSD: unstr.c,v 1.15 2020/04/29 21:00:42 nia Exp $");
#endif
#endif /* not lint */
@ -114,7 +114,7 @@ main(int ac __unused, char **av)
void
getargs(char *av[])
{
if (!*++av) {
if (!*++av || (strlen(*av) + sizeof(".dat")) > sizeof(Datafile)) {
(void) fprintf(stderr, "usage: unstr datafile\n");
exit(1);
}