netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: jamal <hadi@cyberus.ca>
Cc: Maillist netdev <netdev@oss.sgi.com>
Subject: [PATCH PKT_SCHED 4/17]: Check TCA_ACT_KIND payload size _before_ copying it
Date: Thu, 30 Dec 2004 04:39:33 +0100	[thread overview]
Message-ID: <41D37875.5020103@trash.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 256 bytes --]

Fix payload size checks like this one:

-                       sprintf(act_name, "%s", (char*)RTA_DATA(kind));
-                       if (RTA_PAYLOAD(kind) >= IFNAMSIZ) {
-                               printk("Action %s bad\n", 
(char*)RTA_DATA(kind))


[-- Attachment #2: 04.diff --]
[-- Type: text/x-patch, Size: 1912 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/12/30 01:45:41+01:00 kaber@coreworks.de 
#   [PKT_SCHED]: Check TCA_ACT_KIND payload size _before_ copying it
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/sched/act_api.c
#   2004/12/30 01:45:35+01:00 kaber@coreworks.de +6 -14
#   [PKT_SCHED]: Check TCA_ACT_KIND payload size _before_ copying it
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
diff -Nru a/net/sched/act_api.c b/net/sched/act_api.c
--- a/net/sched/act_api.c	2004-12-30 04:01:10 +01:00
+++ b/net/sched/act_api.c	2004-12-30 04:01:10 +01:00
@@ -288,11 +288,9 @@
 			goto err_out;
 		kind = tb[TCA_ACT_KIND-1];
 		if (kind != NULL) {
-			sprintf(act_name, "%s", (char*)RTA_DATA(kind));
-			if (RTA_PAYLOAD(kind) >= IFNAMSIZ) {
-				printk("Action %s bad\n", (char*)RTA_DATA(kind));
+			if (RTA_PAYLOAD(kind) >= IFNAMSIZ)
 				goto err_out;
-			}
+			sprintf(act_name, "%s", (char*)RTA_DATA(kind));
 		} else {
 			printk("Action bad kind\n");
 			goto err_out;
@@ -503,12 +501,9 @@
 		goto err_out;
 	kind = tb[TCA_ACT_KIND-1];
 	if (kind != NULL) {
-		sprintf(act_name, "%s", (char*)RTA_DATA(kind));
-		if (RTA_PAYLOAD(kind) >= IFNAMSIZ) {
-			printk("tcf_action_get_1: action %s bad\n",
-			       (char*)RTA_DATA(kind));
+		if (RTA_PAYLOAD(kind) >= IFNAMSIZ)
 			goto err_out;
-		}
+		sprintf(act_name, "%s", (char*)RTA_DATA(kind));
 	} else {
 		printk("tcf_action_get_1: action bad kind\n");
 		goto err_out;
@@ -567,12 +562,9 @@
 	struct tc_action_ops *a_o = NULL;
 
 	if (kind != NULL) {
-		sprintf(act_name, "%s", (char*)RTA_DATA(kind));
-		if (RTA_PAYLOAD(kind) >= IFNAMSIZ) {
-			printk("get_ao: action %s bad\n",
-			       (char*)RTA_DATA(kind));
+		if (RTA_PAYLOAD(kind) >= IFNAMSIZ)
 			return NULL;
-		}
+		sprintf(act_name, "%s", (char*)RTA_DATA(kind));
 	} else {
 		printk("get_ao: action bad kind\n");
 		return NULL;

             reply	other threads:[~2004-12-30  3:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-30  3:39 Patrick McHardy [this message]
2004-12-30 13:34 ` [PATCH PKT_SCHED 4/17]: Check TCA_ACT_KIND payload size _before_ copying it Thomas Graf
2004-12-30 14:20   ` Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41D37875.5020103@trash.net \
    --to=kaber@trash.net \
    --cc=hadi@cyberus.ca \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).