Info_RemoveKey: use memmove instead of strcpy for overlapping memory areas.

Submitted by: Ozkan Sezer
This commit is contained in:
Yamagi Burmeister 2015-08-31 18:53:18 +02:00
parent 445f266843
commit 70c9889d16

View file

@ -322,8 +322,8 @@ anglemod(float a)
int i;
vec3_t corners[2];
/*
* This is the slow, general version
/*
* This is the slow, general version
*/
int
BoxOnPlaneSide2(vec3_t emins, vec3_t emaxs, struct cplane_s *p)
@ -441,7 +441,7 @@ BoxOnPlaneSide(vec3_t emins, vec3_t emaxs, struct cplane_s *p)
p->normal[2] * emaxs[2];
break;
default:
dist1 = dist2 = 0;
dist1 = dist2 = 0;
break;
}
@ -760,7 +760,7 @@ COM_DefaultExtension(char *path, const char *extension)
qboolean bigendien;
/* can't just use function pointers, or dll linkage can
/* can't just use function pointers, or dll linkage can
mess up when qcommon is included in multiple places */
short (*_BigShort)(short l);
short (*_LittleShort)(short l);
@ -772,37 +772,37 @@ float (*_LittleFloat)(float l);
short
BigShort(short l)
{
return _BigShort(l);
return _BigShort(l);
}
short
LittleShort(short l)
{return
_LittleShort(l);
{return
_LittleShort(l);
}
int
BigLong(int l)
{
return _BigLong(l);
return _BigLong(l);
}
int
LittleLong(int l)
{
return _LittleLong(l);
return _LittleLong(l);
}
float
BigFloat(float l)
{
return _BigFloat(l);
return _BigFloat(l);
}
float
LittleFloat(float l)
{
return _LittleFloat(l);
return _LittleFloat(l);
}
short
@ -893,7 +893,7 @@ Swap_Init(void)
}
/*
* does a varargs printf into a temp buffer, so I don't
* does a varargs printf into a temp buffer, so I don't
* need to have varargs versions of all text functions.
*/
char *
@ -1113,7 +1113,7 @@ char *
Info_ValueForKey(char *s, char *key)
{
char pkey[512];
static char value[2][512]; /* use two buffers so compares
static char value[2][512]; /* use two buffers so compares
work without stomping on each other */
static int valueindex;
char *o;
@ -1223,7 +1223,7 @@ Info_RemoveKey(char *s, char *key)
if (!strcmp(key, pkey))
{
strcpy(start, s); /* remove this part */
memmove(start, s, strlen(s) + 1); /* remove this part */
return;
}