summaryrefslogtreecommitdiff
path: root/py/objint.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-06-06 23:08:37 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-06-06 23:08:37 +0300
commitd72bc2713aa04ee5239e12a3df17ce9e50985e13 (patch)
treeaddd080ccd4d5577eeed695945f3dfe52e93e19b /py/objint.c
parentb56a53dfd6595a51918d8631f12cc10cdfdfa4d5 (diff)
objint: Fix corner case in buffer access.
Diffstat (limited to 'py/objint.c')
-rw-r--r--py/objint.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/py/objint.c b/py/objint.c
index 74b756455..331fdfa1b 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -127,7 +127,7 @@ STATIC uint int_as_str_size_formatted(uint base, const char *prefix, char comma)
return num_digits + num_commas + prefix_len + 2; // +1 for sign, +1 for null byte
}
-// This routine expects you to pass in a buffer and size (in *buf and buf_size).
+// This routine expects you to pass in a buffer and size (in *buf and *buf_size).
// If, for some reason, this buffer is too small, then it will allocate a
// buffer and return the allocated buffer and size in *buf and *buf_size. It
// is the callers responsibility to free this allocated buffer.
@@ -154,7 +154,7 @@ char *mp_obj_int_formatted(char **buf, int *buf_size, int *fmt_size, mp_const_ob
#endif
} else {
// Not an int.
- buf[0] = '\0';
+ **buf = '\0';
*fmt_size = 0;
return *buf;
}