diff --git a/clibs b/clibs index d80ba4b60..1854780fe 160000 --- a/clibs +++ b/clibs @@ -1 +1 @@ -Subproject commit d80ba4b609c2aebf5bf38da60367dc0f0e2d50b9 +Subproject commit 1854780fe3073e491775836c22f709668b1fff62 diff --git a/src/kernel/build.test.c b/src/kernel/build.test.c index dc360c000..a123b5db0 100644 --- a/src/kernel/build.test.c +++ b/src/kernel/build.test.c @@ -65,8 +65,11 @@ static building_type *setup_castle(item_type *it_stone) { btype = test_create_buildingtype("castle"); stage = btype->stages = calloc(1, sizeof(building_stage)); + if (!stage) abort(); cons = stage->construction = calloc(1, sizeof(construction)); + if (!cons) abort(); cons->materials = calloc(2, sizeof(requirement)); + if (!cons->materials) abort(); cons->materials[0].number = 1; cons->materials[0].rtype = it_stone->rtype; cons->minskill = 1; @@ -74,8 +77,11 @@ static building_type *setup_castle(item_type *it_stone) { cons->reqsize = 1; cons->skill = SK_BUILDING; stage = stage->next = calloc(1, sizeof(building_stage)); + if (!stage) abort(); cons = stage->construction = calloc(1, sizeof(construction)); + if (!cons) abort(); cons->materials = calloc(2, sizeof(requirement)); + if (!cons->materials) abort(); cons->materials[0].number = 1; cons->materials[0].rtype = it_stone->rtype; cons->minskill = 1; diff --git a/src/kernel/version.c b/src/kernel/version.c index 92a7a6b1e..ca73b77e2 100644 --- a/src/kernel/version.c +++ b/src/kernel/version.c @@ -19,7 +19,8 @@ const char *eressea_version(void) { } int version_no(const char *str) { - int maj = 0, min = 0, pat = 0; - sscanf(str, "%4d.%4d.%4d", &maj, &min, &pat); + int c, maj = 0, min = 0, pat = 0; + c = sscanf(str, "%4d.%4d.%4d", &maj, &min, &pat); + assert(c == 3); return (maj << 16) | (min << 8) | pat; } diff --git a/src/tests.c b/src/tests.c index f6a87b396..26e57d23a 100644 --- a/src/tests.c +++ b/src/tests.c @@ -277,6 +277,7 @@ void test_create_calendar(void) { config_set_int("game.start", 184); months_per_year = 9; month_season = malloc(sizeof(int) * months_per_year); + if (!month_season) abort(); month_season[0] = SEASON_SUMMER; month_season[1] = SEASON_AUTUMN; month_season[2] = SEASON_AUTUMN; diff --git a/src/util/crypto/crypt_blowfish/wrapper.c b/src/util/crypto/crypt_blowfish/wrapper.c index b69ba7ae6..012a3c706 100644 --- a/src/util/crypto/crypt_blowfish/wrapper.c +++ b/src/util/crypto/crypt_blowfish/wrapper.c @@ -250,7 +250,9 @@ char *__crypt_gensalt_ra(const char *prefix, unsigned long count, if (!dst) __set_errno(ENOMEM); #endif - retval = memcpy(dst, retval, len); + if (dst) { + retval = memcpy(dst, retval, len); + } } return retval;