Re: [PATCH] Support "core.excludesfile = ~/.gitignore"
- From
Bert Wesarg <bert.wesarg@googlemail.com>
- Date
- Aug 22, 2008, 17:56 UTC
- Message-ID
- <36ca99e90808221056i6d79b122occ4ae1e21da6a221@mail.gmail.com>
- In-Reply-To
- <loom.20080822T165656-932@post.gmane.org>
On Fri, Aug 22, 2008 at 18:58, Eric Raible <raible@gmail.com> wrote:
Show 6 quoted lines
> Karl Chen <quarl <at> cs.berkeley.edu> writes:
>
>> +static char const *git_config_subst_userdir(char const *value) {
>> + if (value[0] == '~' && value[1] == '/') {
>
> Might you want to check that strlen(value) is at least 2?No.
swtich (strlen(value)) {
case 0:
/* value[0] == '\0' => value[0] != '~'
value[1] will never be dereferenced, because of lazy && */
case 1:
/* value[0] != '\0'
if (value[0] == '~')
value[1] == '\0' => value[1] != '/' */
default:
/* ... */
}So no invalid memory dereferences.
Regards Bert
Show 8 quoted lines
> > - Eric > > -- > To unsubscribe from this list: send the line "unsubscribe git" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >