From the course: Writing Secure Code in iOS by Infosec

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Format string attack, part 2

Format string attack, part 2

- Format String Attack, Part 2. Let's talk about Swift's format string in double precision. And let's set up an int of 42, a float of 1.3. It has a precision of six and a double of 100.123456789. Now a double has a precision of 15, but if you don't specify the precision level, it will round it at six. And we'll see that in a moment. And then we're going to say some string is a string and we're going to put in a digit. Here's one of our format strings, one of our placeholders here, one of our specifiers, and then a float and then a double. And then we're declaring the precision level by saying nine. 'Cause if we didn't, it would just cut it off at the sixth number after the dot. So this is a double with a capital F, but we let the precision be nine, not six, which is the default. And we have to say that this, this, and this, these specifiers equate to this, this, and this. The INT_VALUE and the FLOAT_VALUE and the DOUBLE_VALUE. What we expect to see is this output right here. All…

Contents