All pastes #913076 Raw Edit

tc qdisc segfault

public diff v1 · immutable
·published 2008-02-21 20:39 UTC
rendered paste body
--- iproute2-2.6.23.orig/tc/tc_qdisc.c	2007-10-16 23:27:42.000000000 +0200+++ iproute2-2.6.23/tc/tc_qdisc.c	2008-02-21 20:33:33.000000000 +0100@@ -172,6 +172,7 @@ 	struct rtattr * tb[TCA_MAX+1]; 	struct qdisc_util *q; 	char abuf[256];+	char *kind;  	if (n->nlmsg_type != RTM_NEWQDISC && n->nlmsg_type != RTM_DELQDISC) { 		fprintf(stderr, "Not a qdisc\n");@@ -197,7 +198,8 @@ 	if (n->nlmsg_type == RTM_DELQDISC) 		fprintf(fp, "deleted "); -	fprintf(fp, "qdisc %s %x: ", (char*)RTA_DATA(tb[TCA_KIND]), t->tcm_handle>>16);+	kind = RTA_DATA(tb[TCA_KIND]);+	fprintf(fp, "qdisc %s %x: ", kind, t->tcm_handle>>16); 	if (filter_ifindex == 0) 		fprintf(fp, "dev %s ", ll_index_to_name(t->tcm_ifindex)); 	if (t->tcm_parent == TC_H_ROOT)@@ -211,15 +213,15 @@ 	} 	/* pfifo_fast is generic enough to warrant the hardcoding --JHS */ -	if (0 == strcmp("pfifo_fast", RTA_DATA(tb[TCA_KIND])))+	if (0 == strcmp("pfifo_fast", kind)) 		q = get_qdisc_kind("prio"); 	else-		q = get_qdisc_kind(RTA_DATA(tb[TCA_KIND]));+		q = get_qdisc_kind(kind);  	if (tb[TCA_OPTIONS]) { 		if (q) 			q->print_qopt(q, fp, tb[TCA_OPTIONS]);-		else+		else	 			fprintf(fp, "[cannot parse qdisc parameters]"); 	} 	fprintf(fp, "\n");