From e9d42e5681739dda041ae612f3c9a4a31b131bbd Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 7 Dec 2017 19:46:21 +0100 Subject: [PATCH] s3:registry: Fix size types and length calculations This fixes compilation with -Wstrict-overflow=2 Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Wed Mar 21 04:25:39 CET 2018 on sn-devel-144 --- source3/registry/reg_format.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/source3/registry/reg_format.c b/source3/registry/reg_format.c index 15f63c7c06a..36ccb626194 100644 --- a/source3/registry/reg_format.c +++ b/source3/registry/reg_format.c @@ -54,16 +54,17 @@ static void cstr_unescape(char* val) * @see srprs_val_name */ static int cbuf_print_value_assign(cbuf* ost, const char* name) { - int ret, n; + size_t ret = 0; + int n; if (*name == '\0') { - ret = cbuf_putc(ost, '@'); + n = cbuf_putc(ost, '@'); } else { - ret = cbuf_print_quoted_string(ost, name); + n = cbuf_print_quoted_string(ost, name); } - - if (ret<0) { - return ret; + if (n < 0) { + return n; } + ret += n; n = cbuf_putc(ost, '='); if (n < 0) { @@ -120,7 +121,8 @@ cbuf_print_hive(cbuf* ost, const char* hive, int len, const struct fmt_key* fmt) static int cbuf_print_keyname(cbuf* ost, const char* key[], int n, const struct fmt_key* fmt) { - int r, ret=0; + int r; + size_t ret = 0; size_t pos = cbuf_getpos(ost); bool hive = true; -- 2.34.1