8000 Fix possible crash in SQLiteDatabase.changePassword functions · boxer/android-database-sqlcipher@da1cc4e · GitHub
[go: up one dir, main page]

Skip to content

Commit da1cc4e

Browse files
author
Christopher J. Brody
committed
Fix possible crash in SQLiteDatabase.changePassword functions
1 parent a7760e9 commit da1cc4e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/net/sqlcipher/database/SQLiteDatabase.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ public void changePassword(String password) throws SQLiteException {
100100
if (!isOpen()) {
101101
throw new SQLiteException("database not open");
102102
}
103-
native_rekey(password);
103+
if (password != null) {
104+
native_rekey(password);
105+
}
104106
}
105107

106108
/**
@@ -119,7 +121,9 @@ public void changePassword(char[] password) throws SQLiteException {
119121
if (!isOpen()) {
120122
throw new SQLiteException("database not open");
121123
}
122-
native_rekey(password == null ? null : String.valueOf(password));
124+
if (password != null) {
125+
native_rekey(String.valueOf(password));
126+
}
123127
}
124128

125129
private static void loadICUData(Context context, File workingDir) {
@@ -2829,7 +2833,7 @@ private static ArrayList<Pair<String, String>> getAttachedDbs(SQLiteDatabase dbO
28292833

28302834
private native int native_status(int operation, boolean reset);
28312835

2832-
private native void native_key(char[] key) throws SQLException;
2836+
private native void native_key(char[] key) throws SQLException;
28332837

28342838
private native void native_rekey(String key) throws SQLException;
28352839
}

0 commit comments

Comments
 (0)
0