summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2002-04-02 00:36:12 +0000
committerManuel Novoa III <mjn3@codepoet.org>2002-04-02 00:36:12 +0000
commit4fea5868d240fc3354309df8bf6673735a0ab903 (patch)
treea75bdd4e2af157ef06657a27f045a00efd434add /libc
parentcecb282ed331701073fd76196ddb734b0f14ec47 (diff)
Fix an arg promotion handling bug in _do_one_spec for %c reported
by Ilguiz Latypov <ilatypov@superbt.com>.
Diffstat (limited to 'libc')
-rw-r--r--libc/stdio/printf.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c
index 5bdec7ae4..efacc6bee 100644
--- a/libc/stdio/printf.c
+++ b/libc/stdio/printf.c
@@ -31,6 +31,13 @@
*
* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! */
+/* 4-01-2002
+ * Initialize thread locks for fake files in vsnprintf and vdprintf.
+ * reported by Erik Andersen (andersen@codepoet.com)
+ * Fix an arg promotion handling bug in _do_one_spec for %c.
+ * reported by Ilguiz Latypov <ilatypov@superbt.com>
+ */
+
#define _ISOC99_SOURCE /* for ULLONG primarily... */
#define _GNU_SOURCE
@@ -1074,7 +1081,7 @@ int _do_one_spec(FILE * __restrict stream, register ppfs_t *ppfs, int *count)
}
#endif
{
- register char *s;
+ register char *s; /* TODO: Should s be unsigned char * ? */
if (ppfs->conv_num == CONV_n) {
_store_inttype(*(void **)*argptr,
@@ -1172,7 +1179,7 @@ int _do_one_spec(FILE * __restrict stream, register ppfs_t *ppfs, int *count)
}
} else { /* char */
s = (char *) buf;
- *s = *((const char *) *argptr);
+ *s = (unsigned char)(*((const int *) *argptr));
s[1] = 0;
slen = 1;
}