]> git.ipfire.org Git - people/ric9/pakfire.git/commitdiff
ELF: Actually return NULL if there is no Build ID
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 9 Jan 2025 16:33:31 +0000 (16:33 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 9 Jan 2025 16:33:31 +0000 (16:33 +0000)
Before, we allocated an empty string which is unnecessary and confused
me further down the line.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/elf.c

index 68d6a8c432ed41a4910965b56d2ab727bf7e4734..caf508a33420e48424ee23d9cd7f231177a4fe36 100644 (file)
@@ -263,6 +263,10 @@ const char* pakfire_elf_build_id(struct pakfire_elf* self) {
                        return NULL;
                }
 
+               // Return NULL if there is no Build ID
+               if (!length)
+                       return NULL;
+
                // Convert the Build ID to hex
                self->build_id = __pakfire_hexlify(buffer, length);
                if (!self->build_id) {