]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
winbind: Use vasprintf() in winbindd_cache
authorVolker Lendecke <vl@samba.org>
Wed, 27 Nov 2019 18:00:26 +0000 (19:00 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 2 Dec 2019 21:23:35 +0000 (21:23 +0000)
Don't need to panic, we can do explicit checks in these few callers

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martins@samba.org>
source3/winbindd/winbindd_cache.c

index 9122e2bc5d691e650cc7d0a244f8320e85e87d28..63368fd18217939433c11c3726cf7592cb5a2ece 100644 (file)
@@ -710,6 +710,7 @@ static struct cache_entry *wcache_fetch(struct winbind_cache *cache,
        va_list ap;
        char *kstr;
        struct cache_entry *centry;
+       int ret;
 
        if (!winbindd_use_cache() ||
            is_my_own_sam_domain(domain) ||
@@ -720,9 +721,13 @@ static struct cache_entry *wcache_fetch(struct winbind_cache *cache,
        refresh_sequence_number(domain);
 
        va_start(ap, format);
-       smb_xvasprintf(&kstr, format, ap);
+       ret = vasprintf(&kstr, format, ap);
        va_end(ap);
 
+       if (ret == -1) {
+               return NULL;
+       }
+
        centry = wcache_fetch_raw(kstr);
        if (centry == NULL) {
                free(kstr);
@@ -752,11 +757,16 @@ static void wcache_delete(const char *format, ...)
        va_list ap;
        char *kstr;
        TDB_DATA key;
+       int ret;
 
        va_start(ap, format);
-       smb_xvasprintf(&kstr, format, ap);
+       ret = vasprintf(&kstr, format, ap);
        va_end(ap);
 
+       if (ret == -1) {
+               return;
+       }
+
        key = string_tdb_data(kstr);
 
        tdb_delete(wcache->tdb, key);
@@ -927,15 +937,20 @@ static void centry_end(struct cache_entry *centry, const char *format, ...)
        va_list ap;
        char *kstr;
        TDB_DATA key, data;
+       int ret;
 
        if (!winbindd_use_cache()) {
                return;
        }
 
        va_start(ap, format);
-       smb_xvasprintf(&kstr, format, ap);
+       ret = vasprintf(&kstr, format, ap);
        va_end(ap);
 
+       if (ret == -1) {
+               return;
+       }
+
        key = string_tdb_data(kstr);
        data.dptr = centry->data;
        data.dsize = centry->ofs;