From: Leo Famulari <leo@famulari.name>
To: Efraim Flashner <efraim@flashner.co.il>
Cc: guix-devel@gnu.org
Subject: Re: cracklib: Fix buffer overflow
Date: Tue, 20 Sep 2016 13:43:10 -0400 [thread overview]
Message-ID: <20160920174310.GA7204@jasmine> (raw)
In-Reply-To: <20160920093201.GB17906@macbook42.flashner.co.il>
[-- Attachment #1: Type: text/plain, Size: 1347 bytes --]
On Tue, Sep 20, 2016 at 12:32:02PM +0300, Efraim Flashner wrote:
> > +diff --git a/src/lib/rules.c b/src/lib/rules.c
> > +index d193cc0..3a2aa46 100644
> > +--- a/lib/rules.c
> > ++++ b/lib/rules.c
> > +@@ -434,9 +434,8 @@ Mangle(input, control) /* returns a pointer to a controlled Mangle */
> > + {
> > + int limit;
> > + register char *ptr;
> > +- static char area[STRINGSIZE];
> > +- char area2[STRINGSIZE];
> > +- area[0] = '\0';
> > ++ static char area[STRINGSIZE * 2] = {0};
> > ++ char area2[STRINGSIZE * 2] = {0};
> > + strcpy(area, input);
> > +
> > + for (ptr = control; *ptr; ptr++)
> > --
> > 2.10.0
> >
>
> not having looked at the full source of lib/rules.c, is there a maximum
> value to STRINGSIZE to make sure STRINGSIZE * 2 doesn't wrap around?
STRINGSIZE is defined in 'lib/packer.h' as 1024:
https://github.com/cracklib/cracklib/blob/cracklib-2.9.6/src/lib/packer.h#L11
I just looked at all the uses of STRINGSIZE in order to give a brief
overview of how it's used, but I'm not skilled enough to recognize every
case where it might be dangerous and overflow.
STRINGSIZE is used to declare many char arrays, an array of pointers,
and as an argument to fgets, snprintf, and strncpy. Also the object
macro TRUNCSTRINGSIZE is defined as (STRINGSIZE / 4).
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-09-20 17:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-15 15:36 cracklib: Fix buffer overflow Leo Famulari
2016-09-20 9:32 ` Efraim Flashner
2016-09-20 17:43 ` Leo Famulari [this message]
2017-01-10 20:33 ` Leo Famulari
2017-01-10 21:44 ` Ludovic Courtès
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160920174310.GA7204@jasmine \
--to=leo@famulari.name \
--cc=efraim@flashner.co.il \
--cc=guix-devel@gnu.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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).