From 275e39a81ca0216958141218a427c6c0e8cdfda0 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 8 May 2007 00:27:20 -0700 Subject: [PATCH] --- yaml --- r: 54621 b: refs/heads/master c: c6b40d16d1cfa1a01158049bb887a9bbe48ef7ba h: refs/heads/master i: 54619: 69d4d4a71cd9576a8adca8565f7b931c6dc82b76 v: v3 --- [refs] | 2 +- trunk/lib/vsprintf.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 9e62d139dee7..860b0e4132b4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 757dea93e136b219af09d3cd56a81063fdbdef1a +refs/heads/master: c6b40d16d1cfa1a01158049bb887a9bbe48ef7ba diff --git a/trunk/lib/vsprintf.c b/trunk/lib/vsprintf.c index cbab1df150cf..017290241261 100644 --- a/trunk/lib/vsprintf.c +++ b/trunk/lib/vsprintf.c @@ -825,6 +825,17 @@ int vsscanf(const char * buf, const char * fmt, va_list args) break; str = next; } + + /* + * Now we've come all the way through so either the input string or the + * format ended. In the former case, there can be a %n at the current + * position in the format that needs to be filled. + */ + if (*fmt == '%' && *(fmt + 1) == 'n') { + int *p = (int *)va_arg(args, int *); + *p = str - buf; + } + return num; }