mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Mark Winterrowd <markwinterrowd4@gmail.com>
To: musl@lists.openwall.com
Subject: Possible out of bounds memory write in initialization of xdigits in src/stdio/vfprintf.c
Date: Thu, 28 Jun 2018 10:31:55 -0700	[thread overview]
Message-ID: <CANravCDuLFZ8tV56ZKo7BpwiKS59a1nSOyuGL1-a9Pis7ZrhxQ@mail.gmail.com> (raw)

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

Hi all,

On line 148 of src/stdio/vfprintf.c in the source tree head, you can
observe the following global initialization:

static const char xdigits[16] = {
"0123456789ABCDEF"
};

Note that while this xdigits array has a length of 16, the string it is
being initialized to has a length of 17, due to the implicit null
terminator. Thus, an additional '\0' will be written just past the end of
this global. I believe this could cause unpredictable effects depending
upon how the compiler and linker handle this situation.

The fix is simple, just write out a list of comma separated characters to
eliminate the null terminator or make xdigits have a length of 17.

Thanks,
Mark Winterrowd

[-- Attachment #2: Type: text/html, Size: 830 bytes --]

             reply	other threads:[~2018-06-28 17:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-28 17:31 Mark Winterrowd [this message]
2018-06-28 17:48 ` Rich Felker

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=CANravCDuLFZ8tV56ZKo7BpwiKS59a1nSOyuGL1-a9Pis7ZrhxQ@mail.gmail.com \
    --to=markwinterrowd4@gmail.com \
    --cc=musl@lists.openwall.com \
    /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/musl/

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