]> git.ipfire.org Git - pakfire.git/commitdiff
util: Validate input for pakfire_string_join
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 5 Oct 2021 21:04:20 +0000 (21:04 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 5 Oct 2021 21:04:20 +0000 (21:04 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/util.c

index 063ec14bf17a97f77853853484ca6c970add3538..221777f42ed0e58c5907ec5ec9919ba6a910cc94 100644 (file)
@@ -391,8 +391,11 @@ char** pakfire_split_string(const char* s, char delim) {
 }
 
 char* pakfire_string_join(char** list, const char* delim) {
-       if (!list)
+       // Validate input
+       if (!list || !delim) {
+               errno = EINVAL;
                return NULL;
+       }
 
        size_t length = 0;
        unsigned int elements = 0;