Truncate access address in case it is spoofed

Fixes an exception on inserting too long IP address
This commit is contained in:
Aurora Lahtela 2024-05-24 17:24:32 +03:00
parent ad98e28e4c
commit edb871661c

View File

@ -57,7 +57,7 @@ public class StoreRequestTransaction extends ThrowawayTransaction {
@Override @Override
public void prepare(PreparedStatement statement) throws SQLException { public void prepare(PreparedStatement statement) throws SQLException {
statement.setLong(1, timestamp); statement.setLong(1, timestamp);
statement.setString(2, accessAddress); statement.setString(2, StringUtils.truncate(accessAddress, 45));
statement.setString(3, method); statement.setString(3, method);
statement.setString(4, url); statement.setString(4, url);
statement.setInt(5, responseCode); statement.setInt(5, responseCode);