]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
arch: Fix off-by-one error in allocation
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 23 Oct 2022 14:53:15 +0000 (14:53 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 23 Oct 2022 14:53:15 +0000 (14:53 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/arch.c

index 2d28b15944f9b168495a88ccc46dc5a8e78fc05e..161a41c52c1f00185c5b9530ac13bbac21106c90 100644 (file)
@@ -139,7 +139,7 @@ PAKFIRE_EXPORT const char** pakfire_supported_arches() {
        if (!__pakfire_supported_arches) {
                for (const struct pakfire_arch* arch = PAKFIRE_ARCHES; arch->name; arch++) {
                        __pakfire_supported_arches = reallocarray(__pakfire_supported_arches,
-                               counter + 1, sizeof(*__pakfire_supported_arches));
+                               counter + 2, sizeof(*__pakfire_supported_arches));
 
                        // Exit if the allocation failed
                        if (!__pakfire_supported_arches)