NetBSD Problem Report #50195

From www@NetBSD.org  Thu Sep  3 08:05:15 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id C0D02A65B8
	for <gnats-bugs@gnats.NetBSD.org>; Thu,  3 Sep 2015 08:05:14 +0000 (UTC)
Message-Id: <20150903080513.97B3DA65BA@mollari.NetBSD.org>
Date: Thu,  3 Sep 2015 08:05:13 +0000 (UTC)
From: henning.petersen@t-online.de
Reply-To: henning.petersen@t-online.de
To: gnats-bugs@NetBSD.org
Subject: Incorrect check in getnameinfo_link.
X-Send-Pr-Version: www-1.0

>Number:         50195
>Category:       lib
>Synopsis:       Incorrect check in getnameinfo_link.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 03 08:10:00 +0000 2015
>Closed-Date:    Thu Aug 24 08:41:06 +0000 2017
>Last-Modified:  Thu Aug 24 08:41:06 +0000 2017
>Originator:     Henning Petersen
>Release:        -current
>Organization:
>Environment:
>Description:
Incorrect check in getnameinfo_link.
Check is n > hostlen should be n >= hostlen.
>How-To-Repeat:

>Fix:
diff -u -p -r1.56 getnameinfo.c
--- lib/libc/net/getnameinfo.c	15 May 2015 14:26:02 -0000	1.56
+++ lib/libc/net/getnameinfo.c	3 Sep 2015 05:57:40 -0000
@@ -536,7 +535,7 @@ getnameinfo_link(const struct sockaddr *

 	if (sdl->sdl_nlen == 0 && sdl->sdl_alen == 0 && sdl->sdl_slen == 0) {
 		n = snprintf(host, hostlen, "link#%u", sdl->sdl_index);
-		if (n < 0 || (socklen_t) n > hostlen) {
+		if (n < 0 || (socklen_t) n >= hostlen) {
 			*host = '\0';
 			return EAI_MEMORY;
 		}

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50195 CVS commit: src/lib/libc/net
Date: Thu, 3 Sep 2015 11:01:19 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Thu Sep  3 15:01:19 UTC 2015

 Modified Files:
 	src/lib/libc/net: getnameinfo.c

 Log Message:
 PR/50195: Henning Petersen: Incorrect check in getnameinfo_link.


 To generate a diff of this commit:
 cvs rdiff -u -r1.56 -r1.57 src/lib/libc/net/getnameinfo.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: maxv@NetBSD.org
State-Changed-When: Thu, 24 Aug 2017 08:41:06 +0000
State-Changed-Why:
Fixed, thanks for the report.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.