Browse code

Add warnings to av_strlcat and av_strlcpy doxygen that the input strings already must be properly 0-terminated strings. Unlike strncpy it cannot be used on raw data read from a file.

Originally committed as revision 19800 to svn://svn.ffmpeg.org/ffmpeg/trunk

Reimar Döffinger authored on 2009/09/10 06:00:51
Showing 1 changed files
... ...
@@ -56,6 +56,10 @@ int av_stristart(const char *str, const char *pfx, const char **ptr);
56 56
  * @param src source string
57 57
  * @param size size of destination buffer
58 58
  * @return the length of src
59
+ *
60
+ * WARNING: since the return value is the length of src, src absolutely
61
+ * _must_ be a properly 0-terminated string, otherwise this will read beyond
62
+ * the end of the buffer and possibly crash.
59 63
  */
60 64
 size_t av_strlcpy(char *dst, const char *src, size_t size);
61 65
 
... ...
@@ -70,6 +74,10 @@ size_t av_strlcpy(char *dst, const char *src, size_t size);
70 70
  * @param src source string
71 71
  * @param size size of destination buffer
72 72
  * @return the total length of src and dst
73
+ *
74
+ * WARNING: since the return value use the length of src and dst, these absolutely
75
+ * _must_ be a properly 0-terminated strings, otherwise this will read beyond
76
+ * the end of the buffer and possibly crash.
73 77
  */
74 78
 size_t av_strlcat(char *dst, const char *src, size_t size);
75 79