Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions rust/src/websocket/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

use super::parser;
use crate::applayer::{self, *};
use crate::conf::conf_get;
use crate::conf::{conf_get, get_memval};
use crate::core::{
sc_app_layer_parser_trigger_raw_stream_inspection, ALPROTO_FAILED, ALPROTO_UNKNOWN, IPPROTO_TCP,
};
Expand Down Expand Up @@ -437,8 +437,15 @@ pub unsafe extern "C" fn SCRegisterWebSocketParser() {
}
SCLogDebug!("Rust websocket parser registered.");
if let Some(val) = conf_get("app-layer.protocols.websocket.max-payload-size") {
if let Ok(v) = val.parse::<u32>() {
WEBSOCKET_MAX_PAYLOAD_SIZE = v;
if let Ok(v) = get_memval(val) {
if let Ok(vu) = u32::try_from(v) {
WEBSOCKET_MAX_PAYLOAD_SIZE = vu;
} else {
SCLogError!(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish we would fix this pattern. We issue errors, but they have no effect, so they are effectively warnings. But we really should propagate these errors I think. Anyway, since this is a common pattern I'll not block the PR over it.

"Too big value for websocket.max-payload-size: max is {}.",
u32::MAX
);
}
} else {
SCLogError!("Invalid value for websocket.max-payload-size");
}
Expand Down
Loading