You should move the definition of string_buffer[] inside darwin_error_str() so the buffer can't be accessed from another function.