]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib/util: strhex_to_data_blob checks talloc
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 10 Aug 2023 02:26:11 +0000 (14:26 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 24 Aug 2023 02:53:30 +0000 (02:53 +0000)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/util/util.c

index b35ba115a7aa69a9d56f034508be2fd96757592b..9d935d5f192188ae367790ff7804afc866e1819e 100644 (file)
@@ -1006,7 +1006,10 @@ _PUBLIC_ size_t strhex_to_str(char *p, size_t p_len, const char *strhex, size_t
 _PUBLIC_ DATA_BLOB strhex_to_data_blob(TALLOC_CTX *mem_ctx, const char *strhex)
 {
        DATA_BLOB ret_blob = data_blob_talloc(mem_ctx, NULL, strlen(strhex)/2+1);
-
+       if (ret_blob.data == NULL) {
+               /* ret_blob.length is already 0 */
+               return ret_blob;
+       }
        ret_blob.length = strhex_to_str((char *)ret_blob.data, ret_blob.length,
                                        strhex,
                                        strlen(strhex));