ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Vladimir Lettiev <thecrux@gmail.com>
To: ALT Linux Team development discussions <devel@lists.altlinux.org>
Subject: Re: [devel] [SCM] packages/gnupg2: heads/master
Date: Tue, 14 Jul 2009 21:37:34 +0400
Message-ID: <20090714173734.GA11410@ubuntu> (raw)
In-Reply-To: <20090714105416.GB1515@wo.int.altlinux.org>

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

On Tue, Jul 14, 2009 at 02:54:16PM +0400, Dmitry V. Levin wrote:
> On Tue, Jul 14, 2009 at 01:46:56PM +0400, Sergey V. Turchin wrote:
> > --- /dev/null
> > +++ b/gnupg-2.0.12-alt-fix-possible-overflow.patch
> > @@ -0,0 +1,11 @@
> > +--- gnupg-2.0.12/g10/keygen.c~	2009-07-13 17:27:14 +0400
> > ++++ gnupg-2.0.12/g10/keygen.c	2009-07-14 13:33:08 +0400
> > +@@ -85,7 +85,7 @@ struct para_data_s {
> > +         u32 creation;
> > +         unsigned int usage;
> > +         struct revocation_key revkey;
> > +-        char value[1];
              ^^^^^^^^^^^^^
> > ++        char value[21];
> > +     } u;
> > + };
> > + 
> 
> После этого изменения gnupg2 начнёт падать.

Как я понимаю, это очень популярный приём для создания поля переменной длины в структуре.
Память выделяется как сумма sizeof(структура)+strlen(данные), а потом в поле, которое
объявлено размером в один байт загоняются данные большей длины и это срабатывает т.к.
памяти выделенно достаточно, хотя с точки зрения компилятора будет переполнение.

Как теперь быть? Какой правильный путь решения такой задачи?

-- 
Vladimir Lettiev aka crux

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  parent reply	other threads:[~2009-07-14 17:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-14 10:54 ` Dmitry V. Levin
2009-07-14 14:56   ` Sergey V Turchin
2009-07-14 10:57     ` Dmitry V. Levin
2009-07-14 15:07       ` Sergey V Turchin
2009-07-14 17:37   ` Vladimir Lettiev [this message]
2009-07-14 18:29     ` Ivan A. Melnikov
2009-07-14 18:34       ` Led
2009-07-14 22:51     ` Dmitry V. Levin
2009-08-18 22:47       ` Dmitry V. Levin
2009-08-18 22:51         ` Dmitry V. Levin
2009-08-19  9:17         ` Michael Shigorin
2009-08-19 12:49           ` Dmitry V. Levin

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=20090714173734.GA11410@ubuntu \
    --to=thecrux@gmail.com \
    --cc=devel@lists.altlinux.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

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git