EnterpriseDB / system_stats

A Postgres extension for exposing system metrics such as CPU, memory and disk information
Other
122 stars 25 forks source link

Use of snprintf over sprintf #33

Closed neel5481 closed 4 months ago

neel5481 commented 4 months ago

Replace the sprintf with snprintf to avoid buffer overflow. Writing too much data to the allocated space can lead to issues such as memory corruption or security threats. Some of the code scanner tool also gives warning for the usage of sprintf.

snprintf helps to prevent buffer overflows by ensuring data does not exceed a specified limit.

Reported by: @BillSmith-EDB