Changes between Version 3 and Version 4 of StringAPI


Ignore:
Timestamp:
2009-07-23T21:34:05Z (15 years ago)
Author:
Jiri Svoboda
Comment:

Handling of buffer overruns

Legend:

Unmodified
Added
Removed
Modified
  • StringAPI

    v3 v4  
    4141Whenever the user supplies an output buffer to a string function, they must also pass the size of this buffer to the function (it is always passed in the following argument). The buffer size ''must be greater than zero''. The function will always fill the buffer with a well-formed string. If the string produced does not fit in the buffer, the function will only store as many (complete) characters as possible and add the null terminator.
    4242
     43This arrangement makes it much easier to avoid accidental buffer overruns. It does not mean, however, that you do not need to check your string sizes carefully. If your string did not fit, it will not cause memory corruption, but instead it will be cropped. This can also lead to a serious bug in some situations, although it will be hopefully easier to detect than memory corruption.
     44
    4345== Function Reference == #FunctionReference
    4446