Skip to content

Commit

Permalink
Prevent buffer overflow (#2212)
Browse files Browse the repository at this point in the history
Signed-off-by: Morten Tokle <[email protected]>
  • Loading branch information
tokle authored Jun 26, 2023
1 parent 2903dad commit ea2b371
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public List<X509CertRecord> updateUnrefreshedCertificatesNotificationTimestamp(S
return new ArrayList<>();
}

boolean notExpired(long currentTime, long lastModified, int expiryTimeMins) {
boolean notExpired(long currentTime, long lastModified, long expiryTimeMins) {
return (currentTime - lastModified < expiryTimeMins * 60 * 1000);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public FileCertRecordStoreConnectionExt(File rootDir) {
}

@Override
boolean notExpired(long currentTime, long lastModified, int expiryTimeMins) {
boolean notExpired(long currentTime, long lastModified, long expiryTimeMins) {
return true;
}
}
Expand Down Expand Up @@ -172,7 +172,12 @@ public void testdeleteExpiredX509CertRecords() throws Exception {

X509CertRecord certRecordCheck = con.getX509CertRecord("ostk", "instance-id", "cn");
assertNotNull(certRecordCheck);


// Verify that certificates are not expired immediately
con.deleteExpiredX509CertRecords(43200); //30 days
certRecordCheck = con.getX509CertRecord("ostk", "instance-id", "cn");
assertNotNull(certRecordCheck);

Thread.sleep(1000);
con.deleteExpiredX509CertRecords(0);

Expand Down

0 comments on commit ea2b371

Please sign in to comment.