NetBSD Problem Report #55041

From www@netbsd.org  Mon Mar  2 13:50:03 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D9BE81A9217
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  2 Mar 2020 13:50:02 +0000 (UTC)
Message-Id: <20200302135002.04BCF1A921A@mollari.NetBSD.org>
Date: Mon,  2 Mar 2020 13:50:01 +0000 (UTC)
From: k4m1@protonmail.com
Reply-To: k4m1@protonmail.com
To: gnats-bugs@NetBSD.org
Subject: syslog(3) segfaults due invalid read address when calling with invalid priority
X-Send-Pr-Version: www-1.0

>Number:         55041
>Category:       lib
>Synopsis:       syslog(3) segfaults due invalid read address when calling with invalid priority
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    christos
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 02 13:55:00 +0000 2020
>Closed-Date:    Sun Jul 25 02:52:13 +0000 2021
>Last-Modified:  Sun Jul 25 02:52:13 +0000 2021
>Originator:     Would rather not specify
>Release:        NetBSD 8.1
>Organization:
>Environment:
NetBSD localhost 8.1 NetBSD 8.1 (GENERIC) #0: Fri May 31 08:43:59 UTC 2019  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
invalid `priority` argument from syslog(3) is taken as argument `const char *s` for strlen(3). This leads to segmentation fault as strlen attempts to read from address `priority`.
>How-To-Repeat:
C source-code to re-trigger segfault:

#include <syslog.h>

int
main()
{
        /* syslog(int priority, const char *message, ...); */
        syslog(-1, "foobar");
}
>Fix:
not exactly sure where the strlen() call with `priority` happens, but
fix would be not to do that, to state the obvious.

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55041 CVS commit: src/lib/libc/gen
Date: Mon, 2 Mar 2020 09:10:24 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Mon Mar  2 14:10:24 UTC 2020

 Modified Files:
 	src/lib/libc/gen: xsyslog.c

 Log Message:
 PR/55041: Fix printf format in syslog(3) error message.


 To generate a diff of this commit:
 cvs rdiff -u -r1.5 -r1.6 src/lib/libc/gen/xsyslog.c

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

Responsible-Changed-From-To: lib-bug-people->christos
Responsible-Changed-By: maya@NetBSD.org
Responsible-Changed-When: Tue, 21 Apr 2020 16:48:14 +0000
Responsible-Changed-Why:
hi christos, do you believe there's anything left to do for this bug? should it be pulled up to releases?


From: "Jukka Ruohonen" <jruoho@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55041 CVS commit: src/tests/lib/libc/gen
Date: Fri, 3 Jul 2020 03:13:11 +0000

 Module Name:	src
 Committed By:	jruoho
 Date:		Fri Jul  3 03:13:10 UTC 2020

 Modified Files:
 	src/tests/lib/libc/gen: t_syslog.c

 Log Message:
 Verify that PR lib/55041 is no longer an issue.


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/gen/t_syslog.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->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 25 Jul 2021 02:52:13 +0000
State-Changed-Why:
Fixed in HEAD, doesn't seem worth pullups since you have to make invalid
calls to trigger it.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.