Re: [hatari-devel] SDL GUI file and directory selection

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Thank you for the fix! It seems to work properly now.

> Am 19.10.2022 um 06:22 schrieb Thomas Huth <th.huth@xxxxxxxxx>:
> 
> Am Tue, 18 Oct 2022 21:55:36 +0200
> schrieb Andreas Grabher <andreas_g86@xxxxxxxxxx>:
>> I got one last question:
>> I noticed that File_MakeValidPathName() outputs just '\0‘ if the input is
>> "/somefile" (some file selected in root directory). I think it should
>> return "/" instead.
> 
> Sounds reasonable, yes!
> 
>> It seems that the if-statement "if (pPathName[0])“ is causing that issue.
>> I tried removing it and didn’t see any regression yet. Does anyone have an
>> idea why this if-statement exists? The explanation of the function tells
>> that empty strings should be left as-is. What does this mean? At least it
>> does not seem to work properly.
> 
> As far as I understand, the intention here is to avoid writing past the end
> of a buffer of empty input strings, e.g. the calling code is doing
> something like this:
> 
>   char str[1] = "";
>   File_MakeValidPathName(str);
> 
> But the check seems to be at the wrong location. It should be done at the
> beginning of the function instead:
> 
> https://git.tuxfamily.org/hatari/hatari.git/commit/?id=08f10f4e728a67d6
> 
> Thanks for the hint!
> 
> Thomas
> 
> 



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/