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; int i;
vec3_t corners[2]; vec3_t corners[2];
/* /*
* This is the slow, general version * This is the slow, general version
*/ */
int int
BoxOnPlaneSide2(vec3_t emins, vec3_t emaxs, struct cplane_s *p) 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]; p->normal[2] * emaxs[2];
break; break;
default: default:
dist1 = dist2 = 0; dist1 = dist2 = 0;
break; break;
} }
@ -760,7 +760,7 @@ COM_DefaultExtension(char *path, const char *extension)
qboolean bigendien; 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 */ mess up when qcommon is included in multiple places */
short (*_BigShort)(short l); short (*_BigShort)(short l);
short (*_LittleShort)(short l); short (*_LittleShort)(short l);
@ -772,37 +772,37 @@ float (*_LittleFloat)(float l);
short short
BigShort(short l) BigShort(short l)
{ {
return _BigShort(l); return _BigShort(l);
} }
short short
LittleShort(short l) LittleShort(short l)
{return {return
_LittleShort(l); _LittleShort(l);
} }
int int
BigLong(int l) BigLong(int l)
{ {
return _BigLong(l); return _BigLong(l);
} }
int int
LittleLong(int l) LittleLong(int l)
{ {
return _LittleLong(l); return _LittleLong(l);
} }
float float
BigFloat(float l) BigFloat(float l)
{ {
return _BigFloat(l); return _BigFloat(l);
} }
float float
LittleFloat(float l) LittleFloat(float l)
{ {
return _LittleFloat(l); return _LittleFloat(l);
} }
short 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. * need to have varargs versions of all text functions.
*/ */
char * char *
@ -1113,7 +1113,7 @@ char *
Info_ValueForKey(char *s, char *key) Info_ValueForKey(char *s, char *key)
{ {
char pkey[512]; 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 */ work without stomping on each other */
static int valueindex; static int valueindex;
char *o; char *o;
@ -1223,7 +1223,7 @@ Info_RemoveKey(char *s, char *key)
if (!strcmp(key, pkey)) if (!strcmp(key, pkey))
{ {
strcpy(start, s); /* remove this part */ memmove(start, s, strlen(s) + 1); /* remove this part */
return; return;
} }