atsign-foundation / at_c

Experimental cross-platform C implementation of the atSDK for SOC & embedded devices
BSD 3-Clause "New" or "Revised" License
2 stars 3 forks source link

at_c: handle malloc == NULL #247

Open JeremyTubongbanua opened 3 weeks ago

JeremyTubongbanua commented 3 weeks ago

If a malicious sender sent a large notification, monitor_read would allocate memory for it and could run out of memory and crash the device

Give monitor_read a max buffer length so that the caller can provide monitor_read with a proper buffer length to hold the value that it is expecting from the receiver.

JeremyTubongbanua commented 3 weeks ago

@XavierChanth says malloc, realloc, and calloc handles that

JeremyTubongbanua commented 3 weeks ago

Renaming this ticket to "handle malloc errors when == NULL"