keepassxreboot / keepassxc

KeePassXC is a cross-platform community-driven port of the Windows application “Keepass Password Safe”.
https://keepassxc.org/
Other
21.47k stars 1.48k forks source link

Crash opening database on macOS 13.0 #8697

Closed jfamiglietti closed 2 years ago

jfamiglietti commented 2 years ago

Overview

Steps to Reproduce

  1. Open Database
  2. Enter password
  3. Press unlock/enter

Expected Behavior

Database opens without crashing

Actual Behavior

Crash

Context

The issue is in the StatusToErrorMessage function at line 34 in TouchID.m. CFStringGetCStringPtr returns NULL which in turn crashes the std::string constructor.

After looking around in the code, I realized I could sidestep the problem by disabling the database quick unlock setting.

As far as fixing it, I used a bridge to NSString to get the underlying UTF8 C-String and it successfully converts the string:

   NSString* resultString = (NSString*)text;
   const char* resultUTF8Chars = [resultString UTF8String];

   std::string result(resultUTF8Chars);
   CFRelease(text);
   return result;

I'm happy to make a pull request with this change if this is ok.

I'm pretty sure this only happens in macOS 13. I have another machine that is still on 12 and running 2.7.3 and it is ok. Also the crash still occurs going back to an older version of KeePassXC on macOS 13.

KeePassXC - Version 2.7.3 Revision: d8483d3

Qt 5.15.6 Debugging mode is enabled.

Operating system: macOS 13.0 CPU architecture: x86_64 Kernel: darwin 22.1.0

Enabled extensions:

Cryptographic libraries:

Operating System: macOS

droidmonkey commented 2 years ago

8676