littlekernel / lk

LK embedded kernel
MIT License
3.15k stars 621 forks source link

the function _vsnprintf_output returns bad count. #153

Open mazhenke opened 8 years ago

mazhenke commented 8 years ago

in function _vsnprintf_output from:lib/libc/printf.c

static int _vsnprintf_output(const char str, size_t len, void state) { struct _output_args *args = state;

size_t count = 0;
while (count < len) {
    if (args->pos < args->len) {
        args->outstr[args->pos++] = *str;
    }

    str++;
    count++;
}

return count;

}

the return value count couldn't represent the actual length of string const char *str.