Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/fortune/unstr unstr: Check that the input filename fit...



details:   https://anonhg.NetBSD.org/src/rev/462124a0f85c
branches:  trunk
changeset: 931733:462124a0f85c
user:      nia <nia%NetBSD.org@localhost>
date:      Wed Apr 29 21:00:42 2020 +0000

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

diffstat:

 games/fortune/unstr/unstr.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 252fb829a0a0 -r 462124a0f85c games/fortune/unstr/unstr.c
--- a/games/fortune/unstr/unstr.c       Wed Apr 29 20:45:05 2020 +0000
+++ b/games/fortune/unstr/unstr.c       Wed Apr 29 21:00:42 2020 +0000
@@ -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 @@
 #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 @@
 void
 getargs(char *av[])
 {
-       if (!*++av) {
+       if (!*++av || (strlen(*av) + sizeof(".dat")) > sizeof(Datafile)) {
                (void) fprintf(stderr, "usage: unstr datafile\n");
                exit(1);
        }



Home | Main Index | Thread Index | Old Index