Why is my string potentially unsecure in my iOS application?

后端 未结 3 1137
灰色年华
灰色年华 2020-12-04 02:02

I am initializing a mutable string and then logging it as follows.

NSMutableString* mStr = [[NSMutableString alloc] init];
mStr = (NSMutableString*) someText         


        
3条回答
  •  死守一世寂寞
    2020-12-04 02:34

    If mStr was set to something like %@, NSLog would try to load an object argument, fail, and probably crash badly. There are other format strings which can also cause havoc.

    If you need to just log a string without any marker text, use:

    NSLog(@"%@", mStr);
    

提交回复
热议问题