Open leorse opened 8 years ago
After allocating an array, fill it with sprintfmay cause segfault or memory damages if the string generated is larger than the allocate size.
sprintf
Use some macro/functions to test the resulting size to know if we are about to overfull the allocated zone
Use function snprintf (Linux/GNU/Unix only?) or _scprintf(VS only?)
snprintf
_scprintf
Done for Linux. Have to check in VS
Problem
After allocating an array, fill it with
sprintf
may cause segfault or memory damages if the string generated is larger than the allocate size.Suggestion
Use some macro/functions to test the resulting size to know if we are about to overfull the allocated zone
Solution?
Use function
snprintf
(Linux/GNU/Unix only?) or_scprintf
(VS only?)