Am 10.06.2018 um 12:56 schrieb René Scharfe:
> Am 10.11.2017 um 20:05 schrieb Elijah Newren:
>> +static struct dir_rename_entry *check_dir_renamed(const char *path,
>> +                                              struct hashmap *dir_renames) {
>> +    char temp[PATH_MAX];
>> +    char *end;
>> +    struct dir_rename_entry *entry;
>> +
>> +    strcpy(temp, path);
>> +    while ((end = strrchr(temp, '/'))) {
>> +            *end = '\0';
>> +            entry = dir_rename_find_entry(dir_renames, temp);
>> +            if (entry)
>> +                    return entry;
>> +    }
>> +    return NULL;
>> +}
> 
> The value of PATH_MAX is platform-dependent, so it's easy to exceed when
> doing cross-platform development.  It's also not a hard limit on most
> operating systems, not even on Windows.  Further reading:
> 
>     https://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html
> 
> So using a fixed buffer is not a good idea, and writing to it without
> checking is dangerous.  Here's a fix:

Argh, I meant to reply to v10 of that patch, i.e. this:

   https://public-inbox.org/git/20180419175823.7946-21-new...@gmail.com/

The cited code wasn't changed and is in current master, though, so both
that part and my patch are still relevant.

René

Reply via email to