Re: [RFH/PATCH] prefix_path(): disallow absolute paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Junio C Hamano <gitster@xxxxxxxxx>:

> Currently, we:
>
>  - Remove "." path component (i.e. the directory leading part
>    specified) from the input;
>
>  - Remove ".." path component and strip one level of the prefix;
>
> only from the beginning.  So if you give nonsense pathspec from
> the command line, you can end up calling prefix_path() with things
> like "/README", "/absolute/path/to//repository/tracked/file", and
> "fo//o/../o".
>
> And not passing such ambiguous path like "fo//o" to the core
> level but sanitizing matters.  Then core level can always do
> memcmp() with "fo/o" to see they are talking about the same
> path.

I may be mistaken but I think "fo//o" and "fo//o/" are returned as two different strings "fo/o" and "fo/o/" from your patch. Shouldn't you clean-up the second one to "fo/o", too?

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

----------------------------------------------------------------------
Free pop3 email with a spam filter.
http://www.bluebottle.com/tag/5

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux