diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2012-09-09 21:07:37 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2012-09-10 10:32:29 +0200 |
commit | 6a8999bf933f72923a271831d85a01ef88a81f39 (patch) | |
tree | 88716952059d2de92d9524de67be55bc232d2492 /src/db | |
parent | f74707245f0517e8d1f2fa7817600ecbc71680c1 (diff) | |
download | sssd-6a8999bf933f72923a271831d85a01ef88a81f39.tar.gz sssd-6a8999bf933f72923a271831d85a01ef88a81f39.tar.bz2 sssd-6a8999bf933f72923a271831d85a01ef88a81f39.zip |
SYSDB: NULL-terminate the output of sysdb_get_{ranges,subdomains}
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/sysdb_ranges.c | 3 | ||||
-rw-r--r-- | src/db/sysdb_subdomains.c | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/db/sysdb_ranges.c b/src/db/sysdb_ranges.c index 416bcdd0..f100f5b8 100644 --- a/src/db/sysdb_ranges.c +++ b/src/db/sysdb_ranges.c @@ -78,7 +78,7 @@ errno_t sysdb_get_ranges(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, goto done; } - list = talloc_zero_array(tmp_ctx, struct range_info *, res->count); + list = talloc_zero_array(tmp_ctx, struct range_info *, res->count + 1); if (list == NULL) { ret = ENOMEM; goto done; @@ -142,6 +142,7 @@ errno_t sysdb_get_ranges(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, goto done; } } + list[res->count] = NULL; *range_count = res->count; *range_list = talloc_steal(mem_ctx, list); diff --git a/src/db/sysdb_subdomains.c b/src/db/sysdb_subdomains.c index 96b8b4b2..b3998a2d 100644 --- a/src/db/sysdb_subdomains.c +++ b/src/db/sysdb_subdomains.c @@ -59,7 +59,7 @@ errno_t sysdb_get_subdomains(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, goto done; } - list = talloc_zero_array(tmp_ctx, struct sysdb_subdom *, res->count); + list = talloc_zero_array(tmp_ctx, struct sysdb_subdom *, res->count + 1); if (list == NULL) { ret = ENOMEM; goto done; @@ -117,6 +117,8 @@ errno_t sysdb_get_subdomains(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, } } + list[res->count] = NULL; + *subdomain_count = res->count; *subdomain_list = talloc_steal(mem_ctx, list); ret = EOK; |