]> git.baikalelectronics.ru Git - kernel.git/commit
sscanf(): fix %*s%n
authorAndy Spencer <andy753421@gmail.com>
Thu, 1 Oct 2009 22:44:27 +0000 (15:44 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 1 Oct 2009 23:11:16 +0000 (16:11 -0700)
commita29447048f2a42cf539440a9ce2ffae59cf58700
tree0d7147c02cda1ae3476698808957477569160c00
parentf2e50b5baea3c7dca2a67761e5faa478d1cda1fd
sscanf(): fix %*s%n

When using %*s, sscanf should honor conversion specifiers immediately
following the %*s.  For example, the following code should find the
position of the end of the string "hello".

  int end;
  char buf[] = "hello    world";
  sscanf(buf, "%*s%n", &end);
  printf("%d\n", end);

Ideally, sscanf would advance the fmt and str pointers the same as it
would without the *, but the code for that is rather complicated and is
not included in the patch.

Signed-off-by: Andy Spencer <andy753421@gmail.com>
Acked-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/vsprintf.c