A heap buffer overflow vulnerability exists in NanoMQ 0.17.2. The vulnerability can be triggered by calling the function copyn_str() 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  messages. 
This vulnerability is different from https://github.com/emqx/nanomq/issues/1153 and https://github.com/emqx/nanomq/issues/1154

**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/231415327-e5e23495-d13f-41f2-8c34-c345ced65e8f.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 < ./poc3.raw
3. NanoMQ crashes

heap-buffer-overflow3 in NanoMQ
This is a GitHub Issue
repo:nanomq
owner:emqx
Title : heap-buffer-overflow3 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  messages. 
This vulnerability is different from https://github.com/emqx/nanomq/issues/1153 and https://github.com/emqx/nanomq/issues/1154

**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/231415327-e5e23495-d13f-41f2-8c34-c345ced65e8f.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 < ./poc3.raw
3. NanoMQ crashes

--- end body ---
