NetBSD Problem Report #59513

From kre@munnari.OZ.AU  Mon Jul  7 03:08:34 2025
Return-Path: <kre@munnari.OZ.AU>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 8B9471A923C
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  7 Jul 2025 03:08:34 +0000 (UTC)
Message-Id: <202507070241.5672f0to005927@jacaranda.noi.kre.to>
Date: Mon, 7 Jul 2025 09:41:00 +0700 (+07)
From: kre@munnari.OZ.AU
To: gnats-bugs@NetBSD.org
Subject: formail (from mail/procmail) core dumps on iscntrl(*p)
X-Send-Pr-Version: 3.95

>Number:         59513
>Category:       pkg
>Synopsis:       formail (from mail/procmail) core dumps on iscntrl(*p)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          needs-pullups
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 07 03:10:00 +0000 2025
>Closed-Date:    
>Last-Modified:  Mon Jul 07 04:34:50 +0000 2025
>Originator:     Robert Elz
>Release:        NetBSD 10.99.14
>Organization:
>Environment:
System: NetBSD jacaranda.noi.kre.to 10.99.14 NetBSD 10.99.14 (JACARANDA:1.1-20250706) #202: Mon Jul 7 01:16:14 +07 2025 kre@jacaranda.noi.kre.to:/usr/obj/testing/kernels/amd64/JACARANDA amd64
Architecture: x86_64
Machine: amd64
>Description:
	formail (which is built as part of pkgsrc/mail/procmail)
	includes a single use of iscntrl() which it uses as
		iscntrl(*p)
	where p is a char *.    Once upon a time that simply
	returned a random result when *p < 0, now it SEGV's (in HEAD anyway).
>How-To-Repeat:
	Use formail on a message containing any UTF-8 (unencoded)
>Fix:
	Add a new mail/procmail/patches/patch-src-formail.c
	containing something like:

--- formail.c.orig	2025-07-07 09:27:24.898676824 +0700
+++ formail.c	2025-07-07 09:14:55.802502352 +0700
@@ -897,7 +897,7 @@
   while(len)
    { switch(*p)
       { default:len--;
-	   if(iscntrl(*p))		    /* no control characters allowed */
+	   if(iscntrl(*(unsigned char *)p))		    /* no control characters allowed */
 	      break;
 	   p++;
 	   continue;



>Release-Note:

>Audit-Trail:
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/59513 CVS commit: pkgsrc/mail/procmail
Date: Mon, 7 Jul 2025 03:36:51 +0000

 Module Name:	pkgsrc
 Committed By:	dholland
 Date:		Mon Jul  7 03:36:51 UTC 2025

 Modified Files:
 	pkgsrc/mail/procmail: Makefile distinfo
 Added Files:
 	pkgsrc/mail/procmail/patches: patch-src_formail.c

 Log Message:
 mail/procmail: fix ctype abuse in formail. From kre in PR 59513.

 PKGREVISION -> 1


 To generate a diff of this commit:
 cvs rdiff -u -r1.59 -r1.60 pkgsrc/mail/procmail/Makefile
 cvs rdiff -u -r1.21 -r1.22 pkgsrc/mail/procmail/distinfo
 cvs rdiff -u -r0 -r1.1 pkgsrc/mail/procmail/patches/patch-src_formail.c

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

State-Changed-From-To: open->needs-pullups
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 07 Jul 2025 04:34:50 +0000
State-Changed-Why:
Committed, thanks.

This should probably get pulled up, but before we do that, let's make
sure nothing unexpectedly blows up.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.