zsh-workers
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayned@users.sourceforge.net>
To: zsh-workers@sunsite.dk
Subject: [PATCH] don't call regfree() on uninitialized regex_t
Date: Mon, 19 Jan 2009 00:22:04 -0800	[thread overview]
Message-ID: <20090119082203.GA16606@blorf.net> (raw)

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

While I was fixing a few compiler warnings in zcond_regex_match(), I
noticed that regfree() could be called on an uninitialized regex_t if
the "id" value passed in to the function was invalid.  Attached is one
possible fix.

..wayne..

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

--- Src/Modules/regex.c	19 Jan 2009 08:00:15 -0000	1.4
+++ Src/Modules/regex.c	19 Jan 2009 08:14:25 -0000
@@ -120,7 +120,7 @@ zcond_regex_match(char **a, int id)
 	break;
     default:
 	DPUTS(1, "bad regex option");
-	break;
+	return 0; /* nothing to cleanup, especially not "re". */
     }
 
     if (matches)

             reply	other threads:[~2009-01-19  8:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-19  8:22 Wayne Davison [this message]
2009-01-19 21:35 ` Phil Pennock

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=20090119082203.GA16606@blorf.net \
    --to=wayned@users.sourceforge.net \
    --cc=zsh-workers@sunsite.dk \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).