[cfe-users] App security and the __FILE__ macro

Rick Mann via cfe-users cfe-users at lists.llvm.org
Fri Apr 13 13:12:25 PDT 2018


It would, indeed. Too bad it's not in the current Xcode.

> On Apr 13, 2018, at 02:30 , Kim Gräsman <kim.grasman at gmail.com> wrote:
> 
> There's a patch waiting for attention here:
> https://reviews.llvm.org/D17741
> 
> Looks like that would be great for you?
> 
> - Kim
> 
> On Fri, Apr 13, 2018 at 9:49 AM, Rick Mann via cfe-users
> <cfe-users at lists.llvm.org> wrote:
>> No kidding! I know we use code similar to that. I’ll have to check when I’m back at the computer.
>> 
>> I also need to find a solution for Swift, but that’s another list.
>> 
>> --
>> Rick Mann
>> rmann at latencyzero.com
>> 
>>> On Apr 12, 2018, at 23:36, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
>>> 
>>> `strrchr(__FILE__, '/')+1` should get resolved at compile-time whenever you have optimizations on.
>>> 
>>>> On Apr 12, 2018, at 15:38, Rick Mann via cfe-users <cfe-users at lists.llvm.org> wrote:
>>>> 
>>>> The higher-ups decided we needed penetration testing of our app. One of their concerns was that if you run the macOS strings tool on our binary and grep for /Users, you get a ton of absolute paths for source files in the project. This is because (I think) we use the __FILE__ macro as part of our logging, to log file:line information. I find this info a boon, and we log that even in release builds to help track down issues reported by customers. At run time, we trim off all of the path except for the filename and extension.
>>>> 
>>>> It would be great if there were a __FILENAME__ macro that did this for me. Is there any such thing?
>>>> 
>>>> Thanks!
>>>> 
>>>> --
>>>> Rick Mann
>>>> rmann at latencyzero.com
>>>> 
>>>> 
>>>> _______________________________________________
>>>> cfe-users mailing list
>>>> cfe-users at lists.llvm.org
>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>>> 
>> 
>> _______________________________________________
>> cfe-users mailing list
>> cfe-users at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


-- 
Rick Mann
rmann at latencyzero.com





More information about the cfe-users mailing list