diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2019-02-20 17:59:37 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2019-02-20 19:18:52 +0100 |
commit | 787a18c467c41d1e5bd8ec05af4afc29df63ea3d (patch) | |
tree | 4c94970e5902190d11d3cceda53ca6693b226a92 /shared/systemd/src/basic/hexdecoct.c | |
parent | 209ff015e26f295bdb7c396962a4e9b4199398fb (diff) | |
parent | 62e6df1f1cd2b3588086dabd38172a30d1253901 (diff) | |
download | NetworkManager-bg/systemd.tar.gz |
systemd: merge branch systemd into masterbg/systemd
Diffstat (limited to 'shared/systemd/src/basic/hexdecoct.c')
-rw-r--r-- | shared/systemd/src/basic/hexdecoct.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/shared/systemd/src/basic/hexdecoct.c b/shared/systemd/src/basic/hexdecoct.c index ffd9a8f60f..7c66cc6285 100644 --- a/shared/systemd/src/basic/hexdecoct.c +++ b/shared/systemd/src/basic/hexdecoct.c @@ -606,10 +606,11 @@ static int base64_append_width( lines = DIV_ROUND_UP(len, width); slen = strlen_ptr(sep); - if (lines > (SSIZE_MAX - plen - 1 - slen) / (indent + width + 1)) + if (plen >= SSIZE_MAX - 1 - slen || + lines > (SSIZE_MAX - plen - 1 - slen) / (indent + width + 1)) return -ENOMEM; - t = realloc(*prefix, plen + 1 + slen + (indent + width + 1) * lines); + t = realloc(*prefix, (ssize_t) plen + 1 + slen + (indent + width + 1) * lines); if (!t) return -ENOMEM; @@ -644,7 +645,7 @@ int base64_append( return base64_append_width(prefix, plen, "\n", indent, p, l, width - indent - 1); else /* leave plen on the left, keep last column free */ - return base64_append_width(prefix, plen, NULL, plen, p, l, width - plen - 1); + return base64_append_width(prefix, plen, " ", plen, p, l, width - plen - 1); } #endif /* NM_IGNORED */ |