diff options
-rw-r--r-- | pkgs/servers/mqtt/nanomq/0.18.2-CVE-2024-31040.patch | 15 | ||||
-rw-r--r-- | pkgs/servers/mqtt/nanomq/default.nix | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/pkgs/servers/mqtt/nanomq/0.18.2-CVE-2024-31040.patch b/pkgs/servers/mqtt/nanomq/0.18.2-CVE-2024-31040.patch new file mode 100644 index 0000000000000..0453415e88d64 --- /dev/null +++ b/pkgs/servers/mqtt/nanomq/0.18.2-CVE-2024-31040.patch @@ -0,0 +1,15 @@ +Based on upstream +https://github.com/nanomq/NanoNNG/commit/543ce93017a488c5001ac450c2a2c1ff6dca19d1 +with conflicting formatting changes removed + +--- a/nng/src/sp/protocol/mqtt/mqtt_parser.c ++++ b/nng/src/sp/protocol/mqtt/mqtt_parser.c +@@ -583,7 +583,7 @@ + if (cparam->pro_ver == MQTT_PROTOCOL_VERSION_v5) { + // check length + log_trace("Decoding MQTT V5 Properties"); +- if (pos >= max) ++ if (pos + 4 >= max) + return PROTOCOL_ERROR; + cparam->prop_len = (uint32_t) get_var_integer(packet + pos, + &len_of_var); diff --git a/pkgs/servers/mqtt/nanomq/default.nix b/pkgs/servers/mqtt/nanomq/default.nix index 902b5369df07c..b85b4af1b95b6 100644 --- a/pkgs/servers/mqtt/nanomq/default.nix +++ b/pkgs/servers/mqtt/nanomq/default.nix @@ -52,6 +52,10 @@ in stdenv.mkDerivation (finalAttrs: { fetchSubmodules = true; }; + patches = [ + ./0.18.2-CVE-2024-31040.patch + ]; + postPatch = '' substituteInPlace CMakeLists.txt \ --replace "DESTINATION /etc" "DESTINATION $out/etc" |