summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/vfprintf.c
diff options
context:
space:
mode:
authorDavid Schultz <das@FreeBSD.org>2009-02-28 06:06:57 +0000
committerDavid Schultz <das@FreeBSD.org>2009-02-28 06:06:57 +0000
commit353ce11c8bf3f695cfa2d412565e03b64afdb26a (patch)
tree7523c9dd08e5896a325226e1c1c23b88ff90a00d /lib/libc/stdio/vfprintf.c
parent9c5cb6d8ae38a9fd39e344721a729d05cf121ce3 (diff)
Notes
Diffstat (limited to 'lib/libc/stdio/vfprintf.c')
-rw-r--r--lib/libc/stdio/vfprintf.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c
index 21e8f824984b..7e5d7fe43a89 100644
--- a/lib/libc/stdio/vfprintf.c
+++ b/lib/libc/stdio/vfprintf.c
@@ -822,22 +822,7 @@ fp_common:
}
} else if ((cp = GETARG(char *)) == NULL)
cp = "(null)";
- if (prec >= 0) {
- /*
- * can't use strlen; can only look for the
- * NUL in the first `prec' characters, and
- * strlen() will go further.
- */
- char *p = memchr(cp, 0, (size_t)prec);
-
- if (p != NULL) {
- size = p - cp;
- if (size > prec)
- size = prec;
- } else
- size = prec;
- } else
- size = strlen(cp);
+ size = (prec >= 0) ? strnlen(cp, prec) : strlen(cp);
sign = '\0';
break;
case 'U':