mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
PR_UglyValueString: increase line[512] to 1024, use q_snprintf
Fixes writing past end of buffer (crashes on some OS'es) when saving xmasjam2018_qmaster1 git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1607 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
2288b9c757
commit
c04be89a90
1 changed files with 9 additions and 9 deletions
|
@ -361,7 +361,7 @@ Easier to parse than PR_ValueString
|
|||
*/
|
||||
static const char *PR_UglyValueString (int type, eval_t *val)
|
||||
{
|
||||
static char line[512];
|
||||
static char line[1024];
|
||||
ddef_t *def;
|
||||
dfunction_t *f;
|
||||
|
||||
|
@ -370,30 +370,30 @@ static const char *PR_UglyValueString (int type, eval_t *val)
|
|||
switch (type)
|
||||
{
|
||||
case ev_string:
|
||||
sprintf (line, "%s", PR_GetString(val->string));
|
||||
q_snprintf (line, sizeof(line), "%s", PR_GetString(val->string));
|
||||
break;
|
||||
case ev_entity:
|
||||
sprintf (line, "%i", NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)));
|
||||
q_snprintf (line, sizeof(line), "%i", NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)));
|
||||
break;
|
||||
case ev_function:
|
||||
f = pr_functions + val->function;
|
||||
sprintf (line, "%s", PR_GetString(f->s_name));
|
||||
q_snprintf (line, sizeof(line), "%s", PR_GetString(f->s_name));
|
||||
break;
|
||||
case ev_field:
|
||||
def = ED_FieldAtOfs ( val->_int );
|
||||
sprintf (line, "%s", PR_GetString(def->s_name));
|
||||
q_snprintf (line, sizeof(line), "%s", PR_GetString(def->s_name));
|
||||
break;
|
||||
case ev_void:
|
||||
sprintf (line, "void");
|
||||
q_snprintf (line, sizeof(line), "void");
|
||||
break;
|
||||
case ev_float:
|
||||
sprintf (line, "%f", val->_float);
|
||||
q_snprintf (line, sizeof(line), "%f", val->_float);
|
||||
break;
|
||||
case ev_vector:
|
||||
sprintf (line, "%f %f %f", val->vector[0], val->vector[1], val->vector[2]);
|
||||
q_snprintf (line, sizeof(line), "%f %f %f", val->vector[0], val->vector[1], val->vector[2]);
|
||||
break;
|
||||
default:
|
||||
sprintf (line, "bad type %i", type);
|
||||
q_snprintf (line, sizeof(line), "bad type %i", type);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue