RE: Windows absolute drive path detection incomplete
- From
- Christopher Ertl <christopher.ertl@microsoft.com>
- Date
- Aug 8, 2019, 16:58 UTC
- Message-ID
- <DB7PR83MB02682420A7444A60F8C9453997D70@DB7PR83MB0268.EURPRD83.prod.outlook.com>
- In-Reply-To
- <CAPig+cSuj6xWjYuQtuiuNQwroqO8sEh4iAGgLqQVOLQr8CMpDQ@mail.gmail.com>
Thanks, Eric, you're absolutely right; good spot!
Christopher Ertl | MSRC Vulnerabilities & Mitigations | Microsoft Limited Microsoft Limited (company number 01624297) is a company registered in England and Wales whose registered office is at Microsoft Campus, Thames Valley Park, Reading. RG6 1WG
-----Original Message----- From: Eric Sunshine <sunshine@sunshineco.com> Sent: Thursday, August 8, 2019 5:51 PM To: Christopher Ertl <Christopher.Ertl@microsoft.com> Cc: git@vger.kernel.org Subject: Re: Windows absolute drive path detection incomplete
On Thu, Aug 8, 2019 at 12:45 PM Christopher Ertl <Christopher.Ertl@microsoft.com> wrote:
> So I'm proposing to remove the check for the drive letter being alpha in `has_dos_drive_prefix` macro: > > #define has_dos_drive_prefix(path) \ > ( (path)[1] == ':' ? 2 : 0)
Nit: This isn't safe and will access memory beyond end-of-string if path is zero-length. Perhaps something like this would be better:
#define has_dos_drive_prefix(path) \
(*(path) && (path)[1] == ':' ? 2 : 0)