diff options
Diffstat (limited to 'sources/iui.c')
-rw-r--r-- | sources/iui.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sources/iui.c b/sources/iui.c index 6f82ad1..4e656c6 100644 --- a/sources/iui.c +++ b/sources/iui.c @@ -148,10 +148,16 @@ void iui_label(iui* ui, u16 x, u16 y, int w, int h, char* fmt, ...) va_list ap = {0}; xctx* x11 = (xctx*)ui->usr; - buf = ar_push(ui->ar, 512); va_start(ap, fmt); - len = vsnprintf(buf, 511, fmt, ap); + len = vsnprintf(NULL, 0, fmt, ap); + va_end(ap); + + if(len) len++; + buf = ar_push(ui->ar, len); + + va_start(ap, fmt); + len = vsnprintf(buf, len, fmt, ap); va_end(ap); { |