From e9047f4f9cee29df2555f246fbe6a5821f624f08 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Tue, 6 Sep 2011 18:24:27 +0000 Subject: Detect sscanf recovering_region input error Missing check for sscanf found by static analyzer. --- daemons/cmirrord/functions.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'daemons/cmirrord') diff --git a/daemons/cmirrord/functions.c b/daemons/cmirrord/functions.c index de807936..16112105 100644 --- a/daemons/cmirrord/functions.c +++ b/daemons/cmirrord/functions.c @@ -1817,8 +1817,11 @@ int pull_state(const char *uuid, uint64_t luid, } if (!strncmp(which, "recovering_region", 17)) { - sscanf(buf, "%llu %u", (unsigned long long *)&lc->recovering_region, - &lc->recoverer); + if (sscanf(buf, "%llu %u", (unsigned long long *)&lc->recovering_region, + &lc->recoverer) != 2) { + LOG_ERROR("cannot parse recovering region from: %s", buf); + return -EINVAL; + } LOG_SPRINT(lc, "CKPT INIT - SEQ#=X, UUID=%s, nodeid = X:: " "recovering_region=%llu, recoverer=%u", SHORT_UUID(lc->uuid), -- cgit