Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 May 2005 19:07:40 +0900
From:      Hajimu UMEMOTO <ume@FreeBSD.org>
To:        Xin LI <delphij@FreeBSD.org>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/lib/libc/gen ttyname.c
Message-ID:  <yge1x88kdjn.wl%ume@mahoroba.org>
In-Reply-To: <yge3bspj9o8.wl%ume@mahoroba.org>
References:  <200505141403.j4EE3LYX097762@repoman.freebsd.org> <yge3bspj9o8.wl%ume@mahoroba.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

>>>>> On Sun, 15 May 2005 15:16:39 +0900
>>>>> Hajimu UMEMOTO <ume@FreeBSD.org> said:

ume> It doesn't test return value of ttyname_r().

It seems there is one more problem.  ttyname_r() doesn't pass correct
buffer size to devname_r().

Index: lib/libc/gen/ttyname.c
diff -u -p lib/libc/gen/ttyname.c.orig lib/libc/gen/ttyname.c
--- lib/libc/gen/ttyname.c.orig	Sun May 15 13:32:19 2005
+++ lib/libc/gen/ttyname.c	Sun May 15 19:02:39 2005
@@ -85,7 +85,7 @@ ttyname_r(int fd, char *buf, size_t len)
 	if (!_ioctl(fd, FIODGNAME, &fgn))
 		return (0);
 	devname_r(sb.st_rdev, S_IFCHR,
-	    buf + strlen(buf), sizeof(buf) - strlen(buf));
+	    buf + strlen(buf), len - strlen(buf));
 	return (0);
 }
 

Sincerely,

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume@mahoroba.org  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?yge1x88kdjn.wl%ume>