SIGABRT on sprintf
<p>My code keep crashing (it's an old iOS app, <em>without ARC</em>). This is the code in question:</p>

<pre><code>- (NSString *) dataToHex:(NSData *)data {
    NSUInteger len2 = [data length] * 2;
    unsigned char* chars = (unsigned char*) [data bytes];

    char finalChar[len2 + 1];

    for(int i = 0; i &lt; len2; i++) {
        sprintf(finalChar + (i * 2), "%02x", chars[i]);
    }

    finalChar[len2] = '\0';

    NSString *hexString = [NSString stringWithFormat:@"%s", finalChar];

    return hexString;
}
</code></pre>

<p>The crash is in the line of <code>sprintf()</code>. Any ideas? I've tried using bigger buffer sizes, but doesn't work.</p>