Skip to content

Commit 3679ee9

Browse files
prusnakpfalcon
authored andcommitted
py: fix null pointer dereference in mpz.c, fix missing va_end in warning.c
1 parent e377f3c commit 3679ee9

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

py/mpz.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1652,7 +1652,10 @@ char *mpz_as_str(const mpz_t *i, mp_uint_t base) {
16521652
// assumes enough space as calculated by mp_int_format_size
16531653
// returns length of string, not including null byte
16541654
mp_uint_t mpz_as_str_inpl(const mpz_t *i, mp_uint_t base, const char *prefix, char base_char, char comma, char *str) {
1655-
if (str == NULL || base < 2 || base > 32) {
1655+
if (str == NULL) {
1656+
return 0;
1657+
}
1658+
if (base < 2 || base > 32) {
16561659
str[0] = 0;
16571660
return 0;
16581661
}

py/warning.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ void mp_warning(const char *msg, ...) {
3838
mp_print_str(&mp_plat_print, "Warning: ");
3939
mp_vprintf(&mp_plat_print, msg, args);
4040
mp_print_str(&mp_plat_print, "\n");
41+
va_end(args);
4142
}
4243

4344
void mp_emitter_warning(pass_kind_t pass, const char *msg) {

0 commit comments

Comments
 (0)