[Change] Changed vsprintf to vsnprintf to be safe.
This commit is contained in:
parent
0573336e27
commit
d3408e38b0
@ -61,7 +61,7 @@ void dialogue_alert(const char* fmt, ...) {
|
|||||||
if(fmt == NULL) return;
|
if(fmt == NULL) return;
|
||||||
else { /* Get the message. */
|
else { /* Get the message. */
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsprintf(msg, fmt, ap);
|
vsnprintf(msg, 512, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ void dialogue_msg(char* caption, const char* fmt, ...) {
|
|||||||
if(fmt == NULL) return;
|
if(fmt == NULL) return;
|
||||||
else {
|
else {
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsprintf(msg, fmt, ap);
|
vsnprintf(msg, 4096, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ int dialogue_YesNo(char* caption, const char* fmt, ...) {
|
|||||||
if(fmt == NULL) return -1;
|
if(fmt == NULL) return -1;
|
||||||
else { /* Get the message. */
|
else { /* Get the message. */
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsprintf(msg, fmt, ap);
|
vsnprintf(msg, 4096, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ char* dialogue_input(char* title, int min, int max, const char* fmt, ...) {
|
|||||||
if(fmt == NULL) return NULL;
|
if(fmt == NULL) return NULL;
|
||||||
else { /* Get the message. */
|
else { /* Get the message. */
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsprintf(msg, fmt, ap);
|
vsnprintf(msg, 512, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
src/font.c
12
src/font.c
@ -131,7 +131,7 @@ void gl_print(const glFont* ft_font, const double x, const double y,
|
|||||||
else {
|
else {
|
||||||
/* convert the symbols to text. */
|
/* convert the symbols to text. */
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsprintf(txt, fmt, ap);
|
vsnprintf(txt, 256, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ int gl_printMax(const glFont* ft_font, const int max,
|
|||||||
else {
|
else {
|
||||||
/* convert the symbols to text. */
|
/* convert the symbols to text. */
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsprintf(txt, fmt, ap);
|
vsnprintf(txt, 256, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ int gl_printMid(const glFont* ft_font, const int width, double x, const double y
|
|||||||
else {
|
else {
|
||||||
/* convert the symbols to text. */
|
/* convert the symbols to text. */
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsprintf(txt, fmt, ap);
|
vsnprintf(txt, 256, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ int gl_printText(const glFont* ft_font, const int width, const int height,
|
|||||||
else {
|
else {
|
||||||
/* Convert the symbols to text. */
|
/* Convert the symbols to text. */
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsprintf(txt, fmt, ap);
|
vsnprintf(txt, 4096, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
bx -= (double)SCREEN_W/2.;
|
bx -= (double)SCREEN_W/2.;
|
||||||
@ -360,7 +360,7 @@ int gl_printWidth(const glFont* ft_font, const char* fmt, ...) {
|
|||||||
else {
|
else {
|
||||||
/* Convert the symbols to text. */
|
/* Convert the symbols to text. */
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsprintf(txt, fmt, ap);
|
vsnprintf(txt, 256, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,7 +396,7 @@ int gl_printHeight(const glFont* ft_font, const int width,
|
|||||||
else {
|
else {
|
||||||
/* Convert the symbols to text. */
|
/* Convert the symbols to text. */
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsprintf(txt, fmt, ap);
|
vsnprintf(txt, 1024, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user