Commit 1db86541 authored by unknown's avatar unknown

my_vsnprintf.c:

  The last character was not printed into out string


strings/my_vsnprintf.c:
  The last character was not printed into out string
parent a320421a
...@@ -84,7 +84,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) ...@@ -84,7 +84,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
if (*fmt == 's') /* String parameter */ if (*fmt == 's') /* String parameter */
{ {
reg2 char *par = va_arg(ap, char *); reg2 char *par = va_arg(ap, char *);
uint plen,left_len = (uint)(end-to); uint plen,left_len = (uint)(end-to)+1;
if (!par) par = (char*)"(null)"; if (!par) par = (char*)"(null)";
plen = (uint) strlen(par); plen = (uint) strlen(par);
if (left_len <= plen) if (left_len <= plen)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment