From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 7394 invoked from network); 12 Nov 2020 18:44:11 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 12 Nov 2020 18:44:11 -0000 Received: (qmail 13759 invoked by uid 550); 12 Nov 2020 18:44:08 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 13723 invoked from network); 12 Nov 2020 18:44:08 -0000 X-Virus-Scanned: Debian amavisd-new at disroot.org From: =?UTF-8?q?=C3=89rico=20Nogueira?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1605206635; bh=6B9vIGO2EPVS4G2sBST4Sx9dmeMkYKIQ2RaLnBByExI=; h=From:To:Cc:Subject:Date; b=Bb9NVYfk5vWS4T4yZk2epXs7nZH8YPTLxtamYAAvAxtTKfHfiN2iguJCuYAWFREsn FGK7BuPclgWAI0o6Jg5UjSO0fNEquQLGcwjHVx7lYUSGGcecPZQ9zE45Yl2mgEj2hj UvV6b9hbVMQJ+oiwUngEnLdMVAuLXb6IAj81mRwzElKLJWW0DCCKg2DhG/KRi4wp54 bS9Vzet/fnMfcQ7QPnxi16EdbzlJCm6FrlZtUEyna6I5zgwSPz67B/Wb22Nw50cCzR /ZXf7EinpawoWQwWrLsccivU3bb7QlDU75BLe6IAYgz1z6bM38dxd6T0098jSLlkVx Fm2Oa/aF5+OdQ== To: musl@lists.openwall.com Cc: =?UTF-8?q?=C3=89rico=20Rolim?= Date: Thu, 12 Nov 2020 15:43:27 -0300 Message-Id: <20201112184327.19431-1-ericonr@disroot.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [musl] [PATCH] fix segfault in lutimes when tv argument is NULL From: Érico Rolim 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