Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pavel I. Kryukov" <kryukov@frtk.ru>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] sim-utils.c: prevent buffer overflow.
Date: Mon, 02 Dec 2019 12:00:00 -0000	[thread overview]
Message-ID: <CADip9gaMywV1WWePmKr0LtAbZzBg6dukdVyxLVbQhph_fvDj0Q@mail.gmail.com> (raw)
In-Reply-To: <20191202100948.GJ3410@embecosm.com>

> > diff --git a/sim/common/sim-utils.c b/sim/common/sim-utils.c
> > index e83a2e4..a60dd92 100644
> > --- a/sim/common/sim-utils.c
> > +++ b/sim/common/sim-utils.c
> > @@ -355,7 +355,7 @@ map_to_str (unsigned map)
> >      case io_map: return "io";
> >      default:
> >        {
> > -       static char str[10];
> > +       static char str[16];
> >         sprintf (str, "(%ld)", (long) map);
>
> I think you could/should change this call to sprintf to use
> xsnprintf instead.

If I understand correctly, xsnprintf is defined in GDB header
(gdb/gdbsupport/common-utils.h) which is C++.

Can we use "pure" snprintf instead?

Thanks,
--
Pavel


  reply	other threads:[~2019-12-02 12:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-30 22:54 Pavel I. Kryukov
2019-12-01 14:46 ` Simon Marchi
2019-12-01 15:33   ` Павел Крюков
2021-01-15  5:18     ` Mike Frysinger via Gdb-patches
2019-12-02 10:09 ` Andrew Burgess
2019-12-02 12:00   ` Pavel I. Kryukov [this message]
2019-12-02 19:06     ` Pavel I. Kryukov
2019-12-02 21:20       ` Andrew Burgess
2019-12-03  9:47         ` Pavel I. Kryukov
2019-12-04 17:39           ` Tom Tromey

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=CADip9gaMywV1WWePmKr0LtAbZzBg6dukdVyxLVbQhph_fvDj0Q@mail.gmail.com \
    --to=kryukov@frtk.ru \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.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