Skip to contentSkip to conversation

mc_opts/mc_verify_opts.c: Initialize local variable

PATCH Applied Bogdan Lezhepekov 2 participants 2 messages Feb 16, 2022 – Jun 9, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mc_opts/mc_verify_opts.c: Initialize local variable

In some cases uninitialized array was used
when comparing strings in main().

---
 testcases/network/multicast/mc_opts/mc_verify_opts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/network/multicast/mc_opts/mc_verify_opts.c +1 -1
index 679b81777..8946324bd 100644
@@ -22,7 +22,7 @@ int main(int argc, char *argv[])
 	unsigned i1, i2, i3, i4;
 	struct hostent *hp, *gethostbyname();
 
-	char sintf[20], gintf[20];
+	char sintf[20], gintf[20] = {0};
 	unsigned char ttl;
 	char loop = 0;
 	unsigned int len = 0;
Signature · 5 lines
2.35.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Applied
#1 lore raw

Hi Bogdan,

Quoted 2 lines

In some cases uninitialized array was used
when comparing strings in main().

Good catch, indeed in case of error on getsockopt() on IP_MULTICAST_IF gintf is really undefined.

Merged, thanks!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp