]> git.ipfire.org Git - pakfire.git/commitdiff
parser: scanner: Abort if we could not allocate memory
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 4 Oct 2023 16:02:21 +0000 (16:02 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 4 Oct 2023 16:02:21 +0000 (16:02 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/parser/scanner.l

index 6bf90a21ea4d25373d296d1b3ef1a2ccb8aea721..e6659cc41c12c10e12f190f4b14b19a034182c05 100644 (file)
@@ -88,6 +88,8 @@ static char* copy_string(const char* s) {
 
        // Allocate a working buffer
        char* buffer = malloc(l + 1);
+       if (!buffer)
+               return NULL;
 
        // Copy input string to buffer
        memcpy(buffer, s, l + 1);