mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Markus Wichmann <nullplan@gmx.net>
To: musl@lists.openwall.com
Subject: Re: [musl] [PATCH] fix segfault in lutimes when tv argument is NULL
Date: Thu, 12 Nov 2020 20:32:07 +0100	[thread overview]
Message-ID: <20201112193207.GC2009@voyager> (raw)
In-Reply-To: <20201112184327.19431-1-ericonr@disroot.org>

On Thu, Nov 12, 2020 at 03:43:27PM -0300, Érico Nogueira wrote:
> From: Érico Rolim <ericonr@disroot.org>
>
> calling lutimes with tv=0 is valid if the applications wants to set the
> timestamps to the current time. short-circuit the function to call
> utimensat with times=0 directly if tv == 0.
> ---
>
> Bug reported on IRC by nmeum
>
>  src/legacy/lutimes.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/legacy/lutimes.c b/src/legacy/lutimes.c
> index 2e5502d1..22176230 100644
> --- a/src/legacy/lutimes.c
> +++ b/src/legacy/lutimes.c
> @@ -5,6 +5,7 @@
>
>  int lutimes(const char *filename, const struct timeval tv[2])
>  {
> +	if (!tv) return utimensat(AT_FDCWD, filename, 0, AT_SYMLINK_NOFOLLOW);
>  	struct timespec times[2];
>  	times[0].tv_sec  = tv[0].tv_sec;
>  	times[0].tv_nsec = tv[0].tv_usec * 1000;
> --
> 2.29.2
>

Deja vu. We had a similar discussion in early March. The most recent
e-mail in that thread stated that the patch "might be correct as-is."
Though that patch did attempt to filter out invalid inputs as well. I
had pointed out that the only spec available for lutimes does state that
it should act like utimes(), and utimes() does allow for NULL inputs,
but there was no reply. And no follow-up from the OP, either.

Ciao,
Markus

  reply	other threads:[~2020-11-12 19:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12 18:43 Érico Nogueira
2020-11-12 19:32 ` Markus Wichmann [this message]
2020-11-12 19:43   ` Érico Nogueira
2020-11-12 20:04     ` Rich Felker
2020-11-12 20:41       ` Érico Nogueira

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=20201112193207.GC2009@voyager \
    --to=nullplan@gmx.net \
    --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).