Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
naotoj committed Nov 30, 2023
1 parent 82967f4 commit 855d0dc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ public char[] readPassword(String fmt, Object ... args) {
return jline.readLine(fmt.formatted(args), '\0').toCharArray();
} catch (EndOfFileException eofe) {
return null;
} finally {
jline.zeroOut();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,8 @@ public interface Buffer {

void copyFrom(Buffer buffer);

// JDK specific modification
default void zeroOut() {
throw new UnsupportedOperationException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -750,4 +750,9 @@ enum SuggestionType {
void setAutosuggestion(SuggestionType type);

SuggestionType getAutosuggestion();

// JDK specific modification
default void zeroOut() {
getBuffer().zeroOut();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
package jdk.internal.org.jline.reader.impl;

import java.util.Arrays;
import java.util.Objects;

import jdk.internal.org.jline.reader.Buffer;
Expand Down Expand Up @@ -369,4 +370,10 @@ private void moveGapToCursor() {
g1 += l;
}
}

// JDK specific modification
@Override
public void zeroOut() {
Arrays.fill(buffer, 0);
}
}

0 comments on commit 855d0dc

Please sign in to comment.