head 1.1; access; symbols; locks; strict; comment @ * @; 1.1 date 2026.05.19.18.38.11; author spz; state Exp; branches; next ; commitid 5x0jwzSnfR7nhsGG; desc @@ 1.1 log @deal with ctype functions faulting on invalid input on NetBSD 11 (by making invalid input less likely) While at it add LICENSE @ text @$NetBSD$ deal with ctype functions faulting on invalid input on NetBSD 11 --- pack_subject.c.orig 2026-05-16 21:28:51.824808400 +0000 +++ pack_subject.c @@@@ -8,7 +8,7 @@@@ #include #include -#include +#include "ctypeconv.h" #include "config.h" #include "global.h" @@@@ -23,7 +23,7 @@@@ pack_subject(register char *dest, regist max_dest = dest + max_length; while (*src) { - if (isspace(*src)) { + if (ISSPACE(*src)) { src++; continue; } @@@@ -49,7 +49,7 @@@@ pack_subject(register char *dest, regist src++; dest = start_dest; - while (isdigit(*src)) + while (ISDIGIT(*src)) *dest++ = *src++; if (dest == start_dest) re++; @@@@ -65,10 +65,10 @@@@ pack_subject(register char *dest, regist while (*src && dest < max_dest) { if (*src == '-' && strncmp("- (nf)", src, 5) == 0) break; - if (isascii(*src) && isspace(*src)) { + if (ISASCII(*src) && ISSPACE(*src)) { do src++; - while (isascii(*src) && isspace(*src)); + while (ISASCII(*src) && ISSPACE(*src)); *dest++ = SP; } else *dest++ = *src++; @