diff options
Diffstat (limited to 'lib/libmtd.c')
-rw-r--r-- | lib/libmtd.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libmtd.c b/lib/libmtd.c index 564e5c0..9d8d0e8 100644 --- a/lib/libmtd.c +++ b/lib/libmtd.c @@ -217,6 +217,7 @@ static int read_hex_ll(const char *file, long long *value) } buf[rd] = '\0'; + *value = 0; if (sscanf(buf, "%llx\n", value) != 1) { errmsg("cannot read integer from \"%s\"\n", file); errno = EINVAL; @@ -269,6 +270,7 @@ static int read_pos_ll(const char *file, long long *value) goto out_error; } + *value = 0; if (sscanf(buf, "%lld\n", value) != 1) { errmsg("cannot read integer from \"%s\"\n", file); errno = EINVAL; |