Module Name:    src
Committed By:   rillig
Date:           Sun Jun 16 18:09:45 UTC 2024

Modified Files:
        src/games/morse: morse.c

Log Message:
games/morse: fix out-of-bounds memory read

Could be triggered by running 'morse äöü', caused by the typical
<ctype.h> usage mistake.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/games/morse/morse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/morse/morse.c
diff -u src/games/morse/morse.c:1.21 src/games/morse/morse.c:1.22
--- src/games/morse/morse.c:1.21	Sun Jun 16 18:00:59 2024
+++ src/games/morse/morse.c	Sun Jun 16 18:09:45 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: morse.c,v 1.21 2024/06/16 18:00:59 rillig Exp $	*/
+/*	$NetBSD: morse.c,v 1.22 2024/06/16 18:09:45 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)morse.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: morse.c,v 1.21 2024/06/16 18:00:59 rillig Exp $");
+__RCSID("$NetBSD: morse.c,v 1.22 2024/06/16 18:09:45 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -188,7 +188,7 @@ main(int argc, char **argv)
 		if (*argv)
 			do {
 				for (p = *argv; *p; ++p)
-					morse((int)*p);
+					morse((unsigned char)*p);
 				show("");
 			} while (*++argv);
 		else while ((ch = getchar()) != EOF)

Reply via email to