From: Cyril Hrubis <chrubis@suse.cz>
To: Martin Doucha <mdoucha@suse.cz>
Cc: Richard Palethorpe <rpalethorpe@suse.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] syscalls/statvfs01: Correcly zero terminate the strings
Date: Thu, 19 Jan 2023 15:41:13 +0100 [thread overview]
Message-ID: <Y8lWibGsvl1DzkXB@yuki> (raw)
In-Reply-To: <37ee8021-c13b-c4a9-f27b-84f504800169@suse.cz>
Hi!
> > memset(valid_fname, 'a', valid_len);
> > memset(toolong_fname, 'b', valid_len + 1);
> >
> > + valid_fname[valid_len] = 0;
> > + toolong_fname[valid_len+1] = 0;
>
> Is there a possibility that valid_len could be equal to PATH_MAX-1?
I do not think so, POSIX explicitly says that PATH_MAX should include
space for terminating null character.
Btw there is NAME_MAX constant that is defined to 256 which is the
usuall maximal lenght + 1.
> I think toolong_fname[] size should be bumped to at least PATH_MAX+1.
Well we can do that (in a separate patch) to be extra sure, but even
then the PATH_MAX seems to be at least order of magnitude larger than
NAME_MAX.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-01-19 14:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 13:36 [LTP] [PATCH] syscalls/statvfs01: Correcly zero terminate the strings Cyril Hrubis
2023-01-18 16:40 ` Petr Vorel
2023-01-18 17:01 ` Martin Doucha
2023-01-18 21:40 ` Petr Vorel
2023-01-19 14:41 ` Cyril Hrubis [this message]
2023-01-19 14:56 ` Martin Doucha
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=Y8lWibGsvl1DzkXB@yuki \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--cc=mdoucha@suse.cz \
--cc=rpalethorpe@suse.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.