17 lines
609 B
C
17 lines
609 B
C
$NetBSD: patch-src_util_mktlds-header.c,v 1.1 2015/09/01 23:24:56 f8l Exp $
|
||
|
||
Fixes char overflow bug causing undefined behaviour.
|
||
It’s apparent when compiling with GCC 4.5 with -O2, for example.
|
||
|
||
--- src/util/mktlds-header.c.orig 2014-03-07 11:39:43.000000000 +0000
|
||
+++ src/util/mktlds-header.c
|
||
@@ -198,7 +198,7 @@ int main()
|
||
if (fgets(buf, sizeof(buf), stdin) == NULL)
|
||
break;
|
||
|
||
- for (ptr = buf+strlen(buf)-1; isspace(*ptr) ||
|
||
+ for (ptr = buf+strlen(buf)-1; isspace((unsigned char)*ptr) ||
|
||
*ptr == '\n' || *ptr == '\r'; ptr --)
|
||
*ptr = '\0';
|
||
|