|
From: João M. S. S. <joa...@gm...> - 2015-01-02 02:12:28
|
On 01/02/2015 01:21 AM, John Reiser wrote: > If there is any doubt [you have at least 1% doubt] then you should replace all uses > of sprintf with snprintf instead. Using snprintf is not a fool-proof cure-all. > If the length limit is reached then the result has no terminating '\0', > so subsequent reads (such as via %s) might over-read the space for the result. > However, this is better than *overwriting* the space for the result. You're right. Done that. I also added a check to the return value of snprintf: if < 0 or >= size an error has occurred. -- João M. S. Silva |