From: Jeff King <peff@peff.net>
To: Shaoxuan Yuan <shaoxuan.yuan02@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com, vdye@github.com,
derrickstolee@github.com
Subject: Re: [PATCH] builtin/mv.c: fix possible segfault in add_slash()
Date: Thu, 8 Sep 2022 22:21:58 -0400 [thread overview]
Message-ID: <YxqjRphSqOHbBzGz@coredump.intra.peff.net> (raw)
In-Reply-To: <20220908230223.239970-1-shaoxuan.yuan02@gmail.com>
On Thu, Sep 08, 2022 at 04:02:23PM -0700, Shaoxuan Yuan wrote:
> The purpose of add_slash() is adding a slash to the end of a string to
> construct a directory path. And, because adding a slash to an empty
> string is of no use here, and checking the string value without checking
> it is non-empty leads to segfault, we should make sure the length of the
> string is positive to solve both problems.
Thanks for picking this up. I had forgotten about it.
The patch looks obviously fine to me from the perspective of stopping
the segfault. I'll take your "of no use here" as a given, not being
familiar with the subtleties of mv's path handling. :) Assuming that's
correct, then everything looks good to me.
-Peff
next prev parent reply other threads:[~2022-09-09 2:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-08 23:02 [PATCH] builtin/mv.c: fix possible segfault in add_slash() Shaoxuan Yuan
2022-09-09 2:21 ` Jeff King [this message]
2022-09-09 14:14 ` Derrick Stolee
2022-09-09 16:37 ` Junio C Hamano
2022-09-09 19:44 ` [PATCH v2] " Shaoxuan Yuan
2022-09-09 20:04 ` Junio C Hamano
2022-09-09 22:40 ` Shaoxuan Yuan
2022-09-09 22:27 ` [PATCH v3] " Shaoxuan Yuan
2022-09-09 22:52 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YxqjRphSqOHbBzGz@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=shaoxuan.yuan02@gmail.com \
--cc=vdye@github.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://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).