From ff32391808322029a8d6caa9fdf1a4d253d9b1ff Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 10 Dec 2012 17:47:15 +0100 Subject: s3-registry: Check return code of push_reg_sz(). Signed-off-by: Andreas Schneider Reviewed-by: Guenther Deschner --- source3/registry/reg_perfcount.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'source3/registry') diff --git a/source3/registry/reg_perfcount.c b/source3/registry/reg_perfcount.c index 3203e092e3..e51d374320 100644 --- a/source3/registry/reg_perfcount.c +++ b/source3/registry/reg_perfcount.c @@ -158,6 +158,7 @@ static uint32 _reg_perfcount_multi_sz_from_tdb(TDB_CONTEXT *tdb, char *buf1 = *retbuf; uint32 working_size = 0; DATA_BLOB name_index, name; + bool ok; memset(temp, 0, sizeof(temp)); snprintf(temp, sizeof(temp), "%d", keyval); @@ -178,7 +179,11 @@ static uint32 _reg_perfcount_multi_sz_from_tdb(TDB_CONTEXT *tdb, buffer_size = 0; return buffer_size; } - push_reg_sz(talloc_tos(), &name_index, (const char *)kbuf.dptr); + ok = push_reg_sz(talloc_tos(), &name_index, (const char *)kbuf.dptr); + if (!ok) { + buffer_size = 0; + return buffer_size; + } memcpy(buf1+buffer_size, (char *)name_index.data, working_size); buffer_size += working_size; /* Now encode the actual name */ @@ -191,7 +196,11 @@ static uint32 _reg_perfcount_multi_sz_from_tdb(TDB_CONTEXT *tdb, memset(temp, 0, sizeof(temp)); memcpy(temp, dbuf.dptr, dbuf.dsize); SAFE_FREE(dbuf.dptr); - push_reg_sz(talloc_tos(), &name, temp); + ok = push_reg_sz(talloc_tos(), &name, temp); + if (!ok) { + buffer_size = 0; + return buffer_size; + } memcpy(buf1+buffer_size, (char *)name.data, working_size); buffer_size += working_size; -- cgit