From: Thomas Jarosch <thomas.jarosch@intra2net.com>
To: git@vger.kernel.org
Subject: [PATCH] Fix buffer overflow in config parser
Date: Thu, 09 Apr 2009 00:13:52 +0200 [thread overview]
Message-ID: <49DD21A0.3040505@intra2net.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 229 bytes --]
Hello together,
attached is a small patch to fix a buffer overflow in config.c.
Patch is against git master's HEAD.
I didn't send this one inline as I wanted to
preserve the 1024+ byte long line.
Best regards,
Thomas Jarosch
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: git-fix-config-buffer-overflow.patch --]
[-- Type: text/x-patch; name="git-fix-config-buffer-overflow.patch", Size: 1671 bytes --]
Fix buffer overflow in config parser.
Segfaulting config looks like this:
---------------------------------------
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
foobar = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaxxxbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa123 4
---------------------------------------
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
diff --git a/config.c b/config.c
index b76fe4c..a9c67e8 100644
--- a/config.c
+++ b/config.c
@@ -72,7 +72,7 @@ static char *parse_value(void)
}
}
if (space) {
- if (len)
+ if (len && len < sizeof(value)-1)
value[len++] = ' ';
space = 0;
}
next reply other threads:[~2009-04-08 22:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-08 22:13 Thomas Jarosch [this message]
2009-04-08 22:58 ` [PATCH] Fix buffer overflow in config parser Markus Heidelberg
2009-04-08 23:15 ` Markus Heidelberg
2009-04-09 7:59 ` Thomas Jarosch
2009-04-10 16:10 ` Markus Heidelberg
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=49DD21A0.3040505@intra2net.com \
--to=thomas.jarosch@intra2net.com \
--cc=git@vger.kernel.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 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).