A heap buffer overflow vulnerability exists in NanoMQ 0.17.2. The vulnerability can be triggered by calling the function nmq_subinfo_decode() in the file mqtt_parser.c. An attacker could exploit this vulnerability to cause a denial of service attack.
**Describe the bug**
We (School of Cyber Science and Technology, Shandong University) found that NanoMQ can cause buffer overflow when it processes malformed SUBSCRIBE messages. 
This vulnerability is different from https://github.com/emqx/nanomq/issues/1153

**Expected behavior**

If Asan is enabled at compile time, the NanoMQ crashes and displays ASAN information.

**Actual Behavior**

If Asan is enabled at compile time, the NanoMQ crashes and displays ASAN information, which can cause DOS.

**To Reproduce**

Similarly, we will send a vulnerability POC via email (jaylin@emqx.io)  to help developers fix this vulnerability.

![image](https://user-images.githubusercontent.com/44093631/231413709-06fbbc79-46df-4b9b-b149-8369d50c9305.png)


**Environment Details**
 - NanoMQ version：master branch version commit #a72347c （As it is also the current HEAD version of [gitee](https://gitee.com/emqx/nanomq?_from=gitee_search) ）
 - Operating system and version：Ubuntu 20.04
 - Compiler and language used：gcc 9.4.0 clang 10.0.0
 - testing scenario

1. start nanomq with ./nanomq start
2. Send the packet：nc 127.0.0.1 1883 < ./poc2.raw
3. NanoMQ crashes

heap-buffer-overflow2 in NanoMQ
This is a GitHub Issue
repo:nanomq
owner:emqx
Title : heap-buffer-overflow2 in NanoMQ
Issue date:

--- start body ---
**Describe the bug**
We (School of Cyber Science and Technology, Shandong University) found that NanoMQ can cause buffer overflow when it processes malformed SUBSCRIBE messages. 
This vulnerability is different from https://github.com/emqx/nanomq/issues/1153

**Expected behavior**

If Asan is enabled at compile time, the NanoMQ crashes and displays ASAN information.

**Actual Behavior**

If Asan is enabled at compile time, the NanoMQ crashes and displays ASAN information, which can cause DOS.

**To Reproduce**

Similarly, we will send a vulnerability POC via email (jaylin@emqx.io)  to help developers fix this vulnerability.

![image](https://user-images.githubusercontent.com/44093631/231413709-06fbbc79-46df-4b9b-b149-8369d50c9305.png)


**Environment Details**
 - NanoMQ version：master branch version commit #a72347c （As it is also the current HEAD version of [gitee](https://gitee.com/emqx/nanomq?_from=gitee_search) ）
 - Operating system and version：Ubuntu 20.04
 - Compiler and language used：gcc 9.4.0 clang 10.0.0
 - testing scenario

1. start nanomq with ./nanomq start
2. Send the packet：nc 127.0.0.1 1883 < ./poc2.raw
3. NanoMQ crashes

--- end body ---

A heap buffer overflow vulnerability in NanoMQ allows attackers to send malformed SUBSCRIBE messages, leading to a Denial of Service (DoS) condition. When ASAN is enabled, the application crashes and provides ASAN information, indicating the presence of the vulnerability.