All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Woerner <twoerner@redhat.com>
To: netfilter-devel@lists.netfilter.org
Subject: [PATCH] iptables-restore -c faults if there are no counters
Date: Thu, 26 Feb 2004 15:14:15 +0100	[thread overview]
Message-ID: <403DFF37.4000302@redhat.com> (raw)

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


Hello,


the function parse_counters does not check the input string and is producing a 
fault if it is NULL.


Thanks,
Thomas

-- 
Thomas Woerner, Software Engineer      Phone: +49-711-96437-0
Red Hat GmbH                           Fax  : +49-711-96437-111
Hauptstaetterstr. 58                   Email: twoerner@redhat.com
D-70178 Stuttgart                      Web  : http://www.redhat.de/

[-- Attachment #2: iptables-1.2.9-counters.patch --]
[-- Type: text/x-patch, Size: 474 bytes --]

--- iptables-1.2.9/iptables-restore.c.counters	2004-02-26 14:52:48.110211624 +0100
+++ iptables-1.2.9/iptables-restore.c	2004-02-26 15:10:24.495616632 +0100
@@ -71,7 +71,11 @@
 
 int parse_counters(char *string, struct ipt_counters *ctr)
 {
-	return (sscanf(string, "[%llu:%llu]", &ctr->pcnt, &ctr->bcnt) == 2);
+	if (string != NULL)
+		return (sscanf(string, "[%llu:%llu]", &ctr->pcnt, &ctr->bcnt)
+			== 2);
+	else
+		return (0 == 2);
 }
 
 /* global new argv and argc */

                 reply	other threads:[~2004-02-26 14:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=403DFF37.4000302@redhat.com \
    --to=twoerner@redhat.com \
    --cc=netfilter-devel@lists.netfilter.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.