projects
/
retroray
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
059429e
)
side-stepped weird snprintf bug
author
John Tsiombikas
<nuclear@member.fsf.org>
Thu, 29 Jun 2023 14:28:22 +0000
(17:28 +0300)
committer
John Tsiombikas
<nuclear@member.fsf.org>
Thu, 29 Jun 2023 14:28:22 +0000
(17:28 +0300)
libs/drawtext/draw.c
patch
|
blob
|
history
diff --git
a/libs/drawtext/draw.c
b/libs/drawtext/draw.c
index
08047c1
..
dec6101
100644
(file)
--- a/
libs/drawtext/draw.c
+++ b/
libs/drawtext/draw.c
@@
-90,24
+90,14
@@
void dtx_substring(const char *str, int start, int end)
void dtx_printf(const char *fmt, ...)
{
va_list ap;
- int buf_size;
- char *buf, tmp;
+ static char buf[1024];
if(!dtx_font) {
return;
}
va_start(ap, fmt);
- buf_size = vsnprintf(&tmp, 0, fmt, ap);
- va_end(ap);
-
- if(buf_size == -1) {
- buf_size = 512;
- }
-
- buf = alloca(buf_size + 1);
- va_start(ap, fmt);
- vsnprintf(buf, buf_size + 1, fmt, ap);
+ vsnprintf(buf, sizeof buf, fmt, ap);
va_end(ap);
dtx_string(buf);