summaryrefslogtreecommitdiffstats
path: root/daemons/cmirrord
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2011-09-06 18:24:27 +0000
committerZdenek Kabelac <zkabelac@redhat.com>2011-09-06 18:24:27 +0000
commite9047f4f9cee29df2555f246fbe6a5821f624f08 (patch)
tree777f3cb61293a45881eee6d7f963d5b3231c1678 /daemons/cmirrord
parentb647de3e0747759ec97138c25425ac3bde94e2aa (diff)
downloadlvm2-e9047f4f9cee29df2555f246fbe6a5821f624f08.tar.gz
lvm2-e9047f4f9cee29df2555f246fbe6a5821f624f08.tar.xz
lvm2-e9047f4f9cee29df2555f246fbe6a5821f624f08.zip
Detect sscanf recovering_region input error
Missing check for sscanf found by static analyzer.
Diffstat (limited to 'daemons/cmirrord')
-rw-r--r--daemons/cmirrord/functions.c7
1 files changed, 5 insertions, 2 deletions
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),