summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorPavol Rusnak <stick@gk2.sk>2016-10-25 11:03:39 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-10-31 23:21:15 +0300
commit3679ee9b520db96772ef0917d0a108180aa70114 (patch)
treec45cae8fe831b6eb481c460a326a4a23428c4d30 /py
parente377f3cb40b34a562ff71753c112edec3d1bd4d1 (diff)
downloadmicropython-3679ee9b520db96772ef0917d0a108180aa70114.tar.gz
micropython-3679ee9b520db96772ef0917d0a108180aa70114.zip
py: fix null pointer dereference in mpz.c, fix missing va_end in warning.c
Diffstat (limited to 'py')
-rw-r--r--py/mpz.c5
-rw-r--r--py/warning.c1
2 files changed, 5 insertions, 1 deletions
diff --git a/py/mpz.c b/py/mpz.c
index cceb079cd3..1dd177b8e7 100644
--- a/py/mpz.c
+++ b/py/mpz.c
@@ -1652,7 +1652,10 @@ char *mpz_as_str(const mpz_t *i, mp_uint_t base) {
// assumes enough space as calculated by mp_int_format_size
// returns length of string, not including null byte
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) {
- if (str == NULL || base < 2 || base > 32) {
+ if (str == NULL) {
+ return 0;
+ }
+ if (base < 2 || base > 32) {
str[0] = 0;
return 0;
}
diff --git a/py/warning.c b/py/warning.c
index eae145bd3f..4cdf3b3f10 100644
--- a/py/warning.c
+++ b/py/warning.c
@@ -38,6 +38,7 @@ void mp_warning(const char *msg, ...) {
mp_print_str(&mp_plat_print, "Warning: ");
mp_vprintf(&mp_plat_print, msg, args);
mp_print_str(&mp_plat_print, "\n");
+ va_end(args);
}
void mp_emitter_warning(pass_kind_t pass, const char *msg) {