Skip to content

Commit 24a3885

Browse files
committed
Do not use statements that "fall through"
Addressing: /home/jcerny/openscap/src/OVAL/probes/independent/sql57_probe.c: In function ‘__clearmem’: /home/jcerny/openscap/src/OVAL/probes/independent/sql57_probe.c:120:10: warning: this statement may fall through [-Wimplicit-fallthrough=] p[2] = (uint8_t)(random() % (1 << 8)); ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/jcerny/openscap/src/OVAL/probes/independent/sql57_probe.c:121:4: note: here case 2: ^~~~ /home/jcerny/openscap/src/OVAL/probes/independent/sql57_probe.c:122:10: warning: this statement may fall through [-Wimplicit-fallthrough=] p[1] = (uint8_t)(random() % (1 << 8)); ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/jcerny/openscap/src/OVAL/probes/independent/sql57_probe.c:123:4: note: here case 1: ^~~~
1 parent cbdb2e0 commit 24a3885

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/OVAL/probes/independent/sql57.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,8 @@ static void __clearmem(void *ptr, int len)
124124
register int l = len % sizeof(uint32_t);
125125
register uint8_t *p = (uint8_t *)ptr;
126126

127-
switch (l) {
128-
case 3:
129-
p[2] = (uint8_t)(random() % (1 << 8));
130-
case 2:
131-
p[1] = (uint8_t)(random() % (1 << 8));
132-
case 1:
133-
p[0] = (uint8_t)(random() % (1 << 8));
127+
for (int i = 0; i < l; i++) {
128+
p[i] = (uint8_t)(random() % (1 << 8));
134129
}
135130
} while (0);
136131
}

0 commit comments

Comments
 (0)