Investigated PVS report for svcmds and did not address type-punning code

This commit is contained in:
BjossiAlfreds 2019-09-23 21:45:50 +00:00
parent a28f567c2c
commit 5cd2216daa
1 changed files with 4 additions and 0 deletions

View File

@ -110,6 +110,7 @@ StringToFilter(char *s, ipfilter_t *f)
s++; s++;
} }
/* PVS NOTE: maybe use memcpy here? */
f->mask = *(unsigned *)m; f->mask = *(unsigned *)m;
f->compare = *(unsigned *)b; f->compare = *(unsigned *)b;
@ -150,6 +151,7 @@ SV_FilterPacket(char *from)
i++, p++; i++, p++;
} }
/* PVS NOTE: maybe use memcpy here? */
in = *(unsigned *)m; in = *(unsigned *)m;
for (i = 0; i < numipfilters; i++) for (i = 0; i < numipfilters; i++)
@ -245,6 +247,7 @@ SVCmd_ListIP_f(void)
for (i = 0; i < numipfilters; i++) for (i = 0; i < numipfilters; i++)
{ {
/* PVS NOTE: maybe use memcpy here? */
*(unsigned *)b = ipfilters[i].compare; *(unsigned *)b = ipfilters[i].compare;
gi.cprintf(NULL, PRINT_HIGH, "%3i.%3i.%3i.%3i\n", b[0], b[1], b[2], b[3]); gi.cprintf(NULL, PRINT_HIGH, "%3i.%3i.%3i.%3i\n", b[0], b[1], b[2], b[3]);
} }
@ -284,6 +287,7 @@ SVCmd_WriteIP_f(void)
for (i = 0; i < numipfilters; i++) for (i = 0; i < numipfilters; i++)
{ {
/* PVS NOTE: maybe use memcpy here? */
*(unsigned *)b = ipfilters[i].compare; *(unsigned *)b = ipfilters[i].compare;
fprintf(f, "sv addip %i.%i.%i.%i\n", b[0], b[1], b[2], b[3]); fprintf(f, "sv addip %i.%i.%i.%i\n", b[0], b[1], b[2], b[3]);
} }