All of lore.kernel.org
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: "Yuriy M. Kaminskiy" <yumkam@gmail.com>
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH 4/4] lib/sysfs: fix format overflow
Date: Thu, 1 Jun 2017 10:40:24 +0200	[thread overview]
Message-ID: <20170601084024.2qahqwvr77hf5iua@ws.net.home> (raw)
In-Reply-To: <m3r2z4eshj.fsf@gmail.com>

On Wed, May 31, 2017 at 10:28:08PM +0300, Yuriy M. Kaminskiy wrote:
> > For some reason I thought d_name would be allocated, in which case
> > strlen() would be
> > more appropriate. Thank you for pointing out it is very static 255
> > buffer, so added the
> 
> Is this *defined by standard*? I believe not.
> === man dirent.h ===
>        The character array d_name is of unspecified size, but  the  number  of
>        bytes preceding the terminating null byte shall not exceed {NAME_MAX}.

I don't read this as sizeof(d->d_name) is wrong thing as it's array.
Anyway, use NAME_MAX seems like the most robust solution.

    Karel


-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

  reply	other threads:[~2017-06-01  8:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-27 18:24 [PATCH 1/4] last: fix format overflow Sami Kerola
2017-05-27 18:24 ` [PATCH 2/4] libblkid: " Sami Kerola
2017-05-27 18:24 ` [PATCH 3/4] lib/loopdev: " Sami Kerola
2017-05-27 18:24 ` [PATCH 4/4] lib/sysfs: " Sami Kerola
2017-05-29 10:09   ` Karel Zak
2017-05-29 14:06     ` Sami Kerola
2017-05-31 19:28       ` Yuriy M. Kaminskiy
2017-06-01  8:40         ` Karel Zak [this message]
2017-06-14 10:09 ` [PATCH 1/4] last: " Karel Zak

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=20170601084024.2qahqwvr77hf5iua@ws.net.home \
    --to=kzak@redhat.com \
    --cc=util-linux@vger.kernel.org \
    --cc=yumkam@gmail.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.