netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] ss: Fix allocation of cong control alg name
@ 2015-05-29 10:30 Vadim Kochan
  2015-05-29 11:04 ` Eric Dumazet
  2015-05-29 11:09 ` Daniel Borkmann
  0 siblings, 2 replies; 10+ messages in thread
From: Vadim Kochan @ 2015-05-29 10:30 UTC (permalink / raw)
  To: netdev; +Cc: Vadim Kochan

From: Vadim Kochan <vadim4j@gmail.com>

Use strdup instead of malloc, and get rid of bad strcpy.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
 misc/ss.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/misc/ss.c b/misc/ss.c
index 347e3a1..a719466 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1908,8 +1908,7 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r,
 
 		if (tb[INET_DIAG_CONG]) {
 			const char *cong_attr = rta_getattr_str(tb[INET_DIAG_CONG]);
-			s.cong_alg = malloc(strlen(cong_attr + 1));
-			strcpy(s.cong_alg, cong_attr);
+			s.cong_alg = strdup(cong_attr);
 		}
 
 		if (TCPI_HAS_OPT(info, TCPI_OPT_WSCALE)) {
-- 
2.3.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-06-25  7:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-29 10:30 [PATCH iproute2] ss: Fix allocation of cong control alg name Vadim Kochan
2015-05-29 11:04 ` Eric Dumazet
2015-05-29 11:11   ` Daniel Borkmann
2015-05-29 12:53   ` Vadim Kochan
2015-05-29 15:15     ` Eric Dumazet
2015-05-29 11:09 ` Daniel Borkmann
2015-05-29 16:17   ` Guzman Mosqueda, Jose R
2015-05-29 16:48     ` Daniel Borkmann
2015-06-25  3:31       ` Stephen Hemminger
2015-06-25  7:12         ` Daniel Borkmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).