Re: [hatari-devel] SDL GUI file and directory selection |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] SDL GUI file and directory selection
- From: Andreas Grabher <andreas_g86@xxxxxxxxxx>
- Date: Wed, 19 Oct 2022 20:43:20 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1666205003; bh=Wx8jU6k9XuefucCGroUI3lh+Jo74+pDGYbEyZULzbRs=; h=Content-Type:From:Mime-Version:Subject:Date:Message-Id:To; b=MDBR7v9/pPSikipMf/8lFUJd03txHYENcowel8GwmF3gRnZ+mpEdGArB8JxBsmSuW eT7ISqiJvGajzp6XrQaL2uX7TXwKQS9Dcxo/7aEeJSPpnJP9Nh383N/FQx/fjDGeT9 uD2det1Snk6MlkM8iCPAZJxHJA3uEnxjmlrsNgGJIhO573CMBLRBu0zrq+/39Wd26H ItzFxqhXu+Lb4YUbTp9rR9L1PvAE/A3n+lv9VMlfOlcvhgdwADUH7ohMmrOQNljKwU v+FkGuuN7kzVKYBtAd22YbbCDZ/h+mQM6mLRS6CJoXVmXQPJoBl3HkrmC/1jUpFSdm pKTOx9HOlTDjw==
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
>
>