git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] builtin/mv.c: fix possible segfault in add_slash()

From
Jeff King <peff@peff.net>
Date
Sep 9, 2022, 02:21 UTC
Message-ID
<YxqjRphSqOHbBzGz@coredump.intra.peff.net>
In-Reply-To
<20220908230223.239970-1-shaoxuan.yuan02@gmail.com>
On Thu, Sep 08, 2022 at 04:02:23PM -0700, Shaoxuan Yuan wrote:
Show 5 quoted lines
> 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
Previous: Shaoxuan YuanNext: Derrick Stolee
Message 2 of 9 in “builtin/mv.c: fix possible segfault in add_slash()”
  1. builtin/mv.c: fix possible segfault in add_slash()Shaoxuan Yuan, Sep 8, 2022
  2. Jeff KingSep 9, 2022
  3. Derrick StoleeSep 9, 2022
  4. Junio C HamanoSep 9, 2022
  5. builtin/mv.c: fix possible segfault in add_slash()Shaoxuan Yuan, Sep 9, 2022
  6. Junio C HamanoSep 9, 2022
  7. Shaoxuan YuanSep 9, 2022
  8. builtin/mv.c: fix possible segfault in add_slash()Shaoxuan Yuan, Sep 9, 2022
  9. Junio C HamanoSep 9, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.