string_utils: always memset buf in lxc_safe_int64_residual()

parent b4733289
...@@ -677,6 +677,8 @@ int lxc_safe_int64_residual(const char *numstr, int64_t *converted, int base, ch ...@@ -677,6 +677,8 @@ int lxc_safe_int64_residual(const char *numstr, int64_t *converted, int base, ch
if (!residual && residual_len != 0) if (!residual && residual_len != 0)
return ret_errno(EINVAL); return ret_errno(EINVAL);
memset(residual, 0, residual_len);
while (isspace(*numstr)) while (isspace(*numstr))
numstr++; numstr++;
...@@ -691,10 +693,8 @@ int lxc_safe_int64_residual(const char *numstr, int64_t *converted, int base, ch ...@@ -691,10 +693,8 @@ int lxc_safe_int64_residual(const char *numstr, int64_t *converted, int base, ch
if (residual) { if (residual) {
size_t len = 0; size_t len = 0;
if (*remaining == '\0') { if (*remaining == '\0')
memset(residual, 0, residual_len);
goto out; goto out;
}
len = strlen(remaining); len = strlen(remaining);
if (len >= residual_len) if (len >= residual_len)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment