Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libutil use the passed parameter instead of PATH_MAX. Ch...
details: https://anonhg.NetBSD.org/src/rev/4576b604b000
branches: trunk
changeset: 332223:4576b604b000
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Fri Sep 12 11:38:23 2014 +0000
description:
use the passed parameter instead of PATH_MAX. Change signedness
of nlen.
diffstat:
lib/libutil/getdiskrawname.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diffs (40 lines):
diff -r 90e17a0b1b6c -r 4576b604b000 lib/libutil/getdiskrawname.c
--- a/lib/libutil/getdiskrawname.c Fri Sep 12 10:03:32 2014 +0000
+++ b/lib/libutil/getdiskrawname.c Fri Sep 12 11:38:23 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getdiskrawname.c,v 1.3 2014/09/12 07:59:36 mlelstv Exp $ */
+/* $NetBSD: getdiskrawname.c,v 1.4 2014/09/12 11:38:23 mlelstv Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: getdiskrawname.c,v 1.3 2014/09/12 07:59:36 mlelstv Exp $");
+__RCSID("$NetBSD: getdiskrawname.c,v 1.4 2014/09/12 11:38:23 mlelstv Exp $");
#include <sys/stat.h>
@@ -44,7 +44,8 @@
resolve_link(char *buf, size_t bufsiz, const char *name)
{
const char *dp;
- ssize_t nlen, dlen;
+ size_t nlen;
+ ssize_t dlen;
dlen = readlink(name, buf, bufsiz-1);
if (dlen == -1)
@@ -56,9 +57,9 @@
dp = strrchr(name, '/');
if (dp != NULL) {
nlen = dp - name + 1;
- if (nlen + 1 > PATH_MAX)
+ if (nlen + 1 > bufsiz)
return NULL;
- if (nlen + dlen + 1 > PATH_MAX)
+ if (nlen + dlen + 1 > bufsiz)
return NULL;
memmove(buf+nlen, buf, dlen+1);
Home |
Main Index |
Thread Index |
Old Index