summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Meier <lm@qgroundcontrol.org>2014-11-11 15:24:07 +0100
committerLorenz Meier <lm@qgroundcontrol.org>2014-11-11 15:24:07 +0100
commit47a94a0979fd5aee2c8416e0197d6ce5926e94ca (patch)
treedfc88c19f05cf944ddf127485e90f905b2eb0a98
parent5ee4b2b2c26bbc35d1669840f0676e8aa383b984 (diff)
parenta50f687344f5bc54de2ca12801d46fb96f5d4b62 (diff)
downloadnuttx-47a94a0979fd5aee2c8416e0197d6ce5926e94ca.tar.gz
nuttx-47a94a0979fd5aee2c8416e0197d6ce5926e94ca.tar.bz2
nuttx-47a94a0979fd5aee2c8416e0197d6ce5926e94ca.zip
Merge pull request #24 from tridge/pullrequest-sscanf-hang
lib_sscanf: fixed a hang in scanf() on end of string
-rw-r--r--nuttx/libc/stdio/lib_sscanf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/nuttx/libc/stdio/lib_sscanf.c b/nuttx/libc/stdio/lib_sscanf.c
index 5c99ee47b..c1ad17323 100644
--- a/nuttx/libc/stdio/lib_sscanf.c
+++ b/nuttx/libc/stdio/lib_sscanf.c
@@ -699,6 +699,10 @@ int vsscanf(FAR char *buf, FAR const char *fmt, va_list ap)
buf++;
}
}
+ else {
+ /* it is not a format specifier, and buf is empty. Stop matching */
+ break;
+ }
}
/* Clean up - read whitespaces */