Vulnerability reported by LimitedResults under Espressif Bug Bounty Program.
Closes https://github.com/espressif/esp-idf/issues/3372