summaryrefslogtreecommitdiff
path: root/source3/registry
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2017-12-07 19:46:21 +0100
committerJeremy Allison <jra@samba.org>2018-03-21 04:25:39 +0100
commite9d42e5681739dda041ae612f3c9a4a31b131bbd (patch)
tree340903e98e7a5c95f0e593a4c7014b4492a75144 /source3/registry
parent0f7a86c46ff90b907615d8f096f86c383ccf3e8e (diff)
downloadsamba-e9d42e5681739dda041ae612f3c9a4a31b131bbd.tar.gz
s3:registry: Fix size types and length calculations
This fixes compilation with -Wstrict-overflow=2 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Mar 21 04:25:39 CET 2018 on sn-devel-144
Diffstat (limited to 'source3/registry')
-rw-r--r--source3/registry/reg_format.c16
1 files 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;