mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
Add max length for central repo value field
This commit is contained in:
parent
c2d208dd32
commit
f444835902
@ -105,7 +105,7 @@ public final class AddEditCentralRepoCommentAction extends AbstractAction {
|
||||
dbManager.updateAttributeInstanceComment(correlationAttribute);
|
||||
}
|
||||
} catch (EamDbException ex) {
|
||||
logger.log(Level.SEVERE, "Error connecting to Central Repository database.", ex);
|
||||
logger.log(Level.SEVERE, "Error adding comment", ex);
|
||||
}
|
||||
}
|
||||
return centralRepoCommentDialog.getComment();
|
||||
|
@ -57,7 +57,10 @@ abstract class AbstractSqlEamDb implements EamDb {
|
||||
private int bulkArtifactsCount;
|
||||
protected int bulkArtifactsThreshold;
|
||||
private final Map<String, Collection<CorrelationAttribute>> bulkArtifacts;
|
||||
|
||||
|
||||
// Maximum length for the value column in the instance tables
|
||||
static final int MAX_VALUE_LENGTH = 128;
|
||||
|
||||
// number of instances to keep in bulk queue before doing an insert.
|
||||
// Update Test code if this changes. It's hard coded there.
|
||||
static final int DEFAULT_BULK_THRESHHOLD = 1000;
|
||||
@ -550,6 +553,12 @@ abstract class AbstractSqlEamDb implements EamDb {
|
||||
if (eamArtifact.getCorrelationValue() == null) {
|
||||
throw new EamDbException("Correlation value is null");
|
||||
}
|
||||
|
||||
// Don't throw an exception here because the calling code may be looping over values.
|
||||
if (eamArtifact.getCorrelationValue().length() >= MAX_VALUE_LENGTH) {
|
||||
logger.log(Level.WARNING, "Artifact value too long for central repository: {0}", eamArtifact.getCorrelationValue());
|
||||
return;
|
||||
}
|
||||
|
||||
Connection conn = connect();
|
||||
|
||||
@ -984,18 +993,22 @@ abstract class AbstractSqlEamDb implements EamDb {
|
||||
throw new EamDbException("CorrelationAttributeInstance known status is null");
|
||||
}
|
||||
|
||||
bulkPs.setString(1, eamInstance.getCorrelationCase().getCaseUUID());
|
||||
bulkPs.setString(2, eamInstance.getCorrelationDataSource().getDeviceID());
|
||||
bulkPs.setInt(3, eamInstance.getCorrelationDataSource().getCaseID());
|
||||
bulkPs.setString(4, eamArtifact.getCorrelationValue());
|
||||
bulkPs.setString(5, eamInstance.getFilePath());
|
||||
bulkPs.setByte(6, eamInstance.getKnownStatus().getFileKnownValue());
|
||||
if ("".equals(eamInstance.getComment())) {
|
||||
bulkPs.setNull(7, Types.INTEGER);
|
||||
if (eamArtifact.getCorrelationValue().length() < MAX_VALUE_LENGTH) {
|
||||
bulkPs.setString(1, eamInstance.getCorrelationCase().getCaseUUID());
|
||||
bulkPs.setString(2, eamInstance.getCorrelationDataSource().getDeviceID());
|
||||
bulkPs.setInt(3, eamInstance.getCorrelationDataSource().getCaseID());
|
||||
bulkPs.setString(4, eamArtifact.getCorrelationValue());
|
||||
bulkPs.setString(5, eamInstance.getFilePath());
|
||||
bulkPs.setByte(6, eamInstance.getKnownStatus().getFileKnownValue());
|
||||
if ("".equals(eamInstance.getComment())) {
|
||||
bulkPs.setNull(7, Types.INTEGER);
|
||||
} else {
|
||||
bulkPs.setString(7, eamInstance.getComment());
|
||||
}
|
||||
bulkPs.addBatch();
|
||||
} else {
|
||||
bulkPs.setString(7, eamInstance.getComment());
|
||||
logger.log(Level.WARNING, "Artifact value too long for central repository: {0}", eamArtifact.getCorrelationValue());
|
||||
}
|
||||
bulkPs.addBatch();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user