Skip to content

Commit 1fa01c6

Browse files
committed
Increase robustness in case more than one message gets transferred at once
1 parent 7a8f6ed commit 1fa01c6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main/java/org/keepassxc/LinuxMacConnection.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ protected JSONObject getCleartextResponse() {
8585
}
8686
log.trace("Reading message: {}", raw);
8787
try {
88+
var s = raw.toString();
89+
// Test, if we received more than one message with the last read
90+
if (s.length() - s.replace("}", "").length() > 1) throw new JSONException("");
8891
return new JSONObject(raw.toString());
8992
} catch (JSONException e) {
9093
log.error("Message corrupted. Received: {}", raw);

0 commit comments

Comments
 (0)