NetBSD Problem Report #52446

From www@NetBSD.org  Mon Jul 31 12:40:56 2017
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" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id A305B7A173
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 31 Jul 2017 12:40:56 +0000 (UTC)
Message-Id: <20170731124055.C42207A211@mollari.NetBSD.org>
Date: Mon, 31 Jul 2017 12:40:55 +0000 (UTC)
From: dcb314@hotmail.com
Reply-To: dcb314@hotmail.com
To: gnats-bugs@NetBSD.org
Subject: src/sys/arch/hpcmips/stand/libsa/devopen.c poor error checking ?
X-Send-Pr-Version: www-1.0

>Number:         52446
>Category:       port-hpcmips
>Synopsis:       src/sys/arch/hpcmips/stand/libsa/devopen.c poor error checking ?
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-hpcmips-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 31 12:45:00 +0000 2017
>Closed-Date:    Tue Aug 01 12:03:44 +0000 2017
>Last-Modified:  Tue Aug 01 12:03:44 +0000 2017
>Originator:     David Binderman
>Release:        cvs-20170731
>Organization:
>Environment:
>Description:
src/sys/arch/hpcmips/stand/libsa/devopen.c:83]: (style) Checking if unsigned variable 'wcstombs(name,(TCHAR*)fname,sizeof(name))' is less than zero.

Source code is

       if (wcstombs(name, (TCHAR*)fname, sizeof(name)) < 0) {
            return (ENOENT);
        }


After a few seconds checking the man page for wcstombs, maybe the
following is better code

        if (wcstombs(name, (TCHAR*)fname, sizeof(name)) == (size_t) -1) {
            return (ENOENT);
        }


>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52446 CVS commit: src/sys/arch/hpcmips/stand/libsa
Date: Tue, 1 Aug 2017 07:58:45 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Tue Aug  1 11:58:45 UTC 2017

 Modified Files:
 	src/sys/arch/hpcmips/stand/libsa: devopen.c

 Log Message:
 PR/52446: Devid Binderman: Fix error checking for wcstombs


 To generate a diff of this commit:
 cvs rdiff -u -r1.6 -r1.7 src/sys/arch/hpcmips/stand/libsa/devopen.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: wiz@NetBSD.org
State-Changed-When: Tue, 01 Aug 2017 12:03:44 +0000
State-Changed-Why:
Fixed by christos, thanks.


>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.