Mercurial > hg > th-libs
changeset 233:1be1a9bab1d3
Add some error checking to th_vprintf_do().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 16 Feb 2016 15:58:50 +0200 |
parents | 917e341d445b |
children | 82acddddb6b1 |
files | th_string.c |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/th_string.c Tue Feb 16 15:55:33 2016 +0200 +++ b/th_string.c Tue Feb 16 15:58:50 2016 +0200 @@ -141,6 +141,10 @@ while (val > 0 && pos < sizeof(buf) - 1); buf[pos] = 0; + // Oops, the value did not fit in the buffer! + if (val > 0) + return -1; + // Do we want a sign prefix? Not for unsigned values if (!unsig) {