NetBSD Problem Report #52445
From www@NetBSD.org Mon Jul 31 12:38: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 65E1E7A173
for <gnats-bugs@gnats.NetBSD.org>; Mon, 31 Jul 2017 12:38:56 +0000 (UTC)
Message-Id: <20170731123855.9FA847A211@mollari.NetBSD.org>
Date: Mon, 31 Jul 2017 12:38:55 +0000 (UTC)
From: dcb314@hotmail.com
Reply-To: dcb314@hotmail.com
To: gnats-bugs@NetBSD.org
Subject: src/sys/arch/hpcmips/stand/pbsdboot/main.c: 2 * poor error checking ?
X-Send-Pr-Version: www-1.0
>Number: 52445
>Category: port-hpcmips
>Synopsis: src/sys/arch/hpcmips/stand/pbsdboot/main.c: 2 * 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:40:00 +0000 2017
>Closed-Date: Tue Aug 01 12:03:55 +0000 2017
>Last-Modified: Tue Aug 01 12:03:55 +0000 2017
>Originator: David Binderman
>Release: cvs-20170731
>Organization:
>Environment:
>Description:
src/sys/arch/hpcmips/stand/pbsdboot/main.c:1121]: (style) Checking if unsigned variable 'wcstombs(kernel_name,wkernel_name,sizeof(kernel_name))' is less than zero.
Source code is
if (wcstombs(options, woptions, sizeof(options)) < 0 ||
wcstombs(kernel_name, wkernel_name,
sizeof(kernel_name)) < 0) {
After a few seconds checking the man page for wcstombs, maybe the
following is better code
if (wcstombs(options, woptions, sizeof(options)) == (size_t) -1 ||
wcstombs(kernel_name, wkernel_name,
sizeof(kernel_name)) == (size_t) -1) {
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/52445 CVS commit: src/sys/arch/hpcmips/stand/pbsdboot
Date: Tue, 1 Aug 2017 07:56:58 -0400
Module Name: src
Committed By: christos
Date: Tue Aug 1 11:56:58 UTC 2017
Modified Files:
src/sys/arch/hpcmips/stand/pbsdboot: main.c
Log Message:
PR/52445: David Binderman: Fix wcstombs error checking
To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/hpcmips/stand/pbsdboot/main.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:55 +0000
State-Changed-Why:
Fixed by christos, thanks.
>Unformatted:
(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.