NetBSD Problem Report #32358

From soda@sra.co.jp  Thu Dec 22 03:59:41 2005
Return-Path: <soda@sra.co.jp>
Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2])
	by narn.netbsd.org (Postfix) with ESMTP id E604D63B8E9
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 22 Dec 2005 03:59:40 +0000 (UTC)
Message-Id: <20051222035939.C6D9345B73@srapc2586.sra.co.jp>
Date: Thu, 22 Dec 2005 12:59:39 +0900 (JST)
From: soda@netbsd.org
Reply-To: soda@netbsd.org
To: gnats-bugs@netbsd.org
Subject: inetd.conf sndbuf/rcvbuf parser is fragile
X-Send-Pr-Version: 3.95

>Number:         32358
>Category:       bin
>Synopsis:       inetd.conf sndbuf/rcvbuf parser is fragile
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 22 04:00:00 +0000 2005
>Last-Modified:  Sat Jan 03 14:55:00 +0000 2015
>Originator:     SODA Noriyuki
>Release:        NetBSD 2.0
>Organization:
The NetBSD project
>Environment:
NetBSD babylon5.netbsd.org 2.0 NetBSD 2.0 (NBFTP) #0: Thu Dec 22 00:49:36 UTC 2005  root@ADMIN:/usr/obj/sys/arch/i386/compile.i386/NBFTP i386
Architecture: i386
Machine: i386
>Description:

If "tcp,sndbuf=262144,rcvbuf=32768" is specified as 3rd field of inetd.conf,
inetd complains "malformed buffer size option `262144'",
if "tcp,sndbuf=128k,rcvbuf=32k" is specified, it works.

>How-To-Repeat:
>Fix:
n/a for now

>Audit-Trail:
From: Miwa Susumu <miwarin@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/32358
Date: Sat, 3 Jan 2015 23:50:05 +0900

 # uname -rsm
 NetBSD 6.1.5 i386

 <<< from here
 # diff -u inetd.c.orig inetd.c
 --- inetd.c.orig        2015-01-03 23:28:24.000000000 +0900
 +++ inetd.c     2015-01-03 23:29:30.000000000 +0900
 @@ -1424,7 +1424,7 @@
                 MALFORMED(arg); \
         val = (int)strtol((arg), &cp0, 10); \
         if (cp0 != NULL) { \
 -               if (cp0[1] != '\0') \
 +               if (cp0 == arg) \
                         MALFORMED((arg)); \
                 if (cp0[0] == 'k') \
                         val *= 1024; \
 >>> to here

 of course, It is an error if you set a large value.

   Jan  3 23:30:37 mogu inetd[3320]: setsockopt (SO_SNDBUF 262144): No
 buffer space available

 [note]
 from the manual.

 strtoq(3)

 > If endptr is non-nil, strtol() stores the address of the first invalid
 > character in *endptr.  If there were no digits at all, however, strtol()
 > stores the original value of nptr in *endptr.  (Thus, if *nptr is not
 > `\0' but **endptr is `\0' on return, the entire string was valid.)

 endptr not be NULL in any case.

 -- 
 miwarin

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.