From f7267994832a1e3abddaf29a1c418bf4b3740b22 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 3 Jul 2002 09:23:36 +0000 Subject: [PATCH] fixed safe_strtoll to check the following characters. --- src/conf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/conf.c b/src/conf.c index aeefa3fa..a71219a0 100644 --- a/src/conf.c +++ b/src/conf.c @@ -463,10 +463,13 @@ typedef struct { int safe_strtoll(const char *str, long long *val) { long long v; + int endidx; if (!*str) return -EINVAL; errno = 0; - if (sscanf(str, "%Ld", &v) != 1) + if (sscanf(str, "%Ld%n", &v, &endidx) < 1) + return -EINVAL; + if (str[endidx]) return -EINVAL; *val = v; return 0; -- 2.47.1