[FFmpeg-cvslog] r19800 - trunk/libavutil/avstring.h

reimar subversion
Wed Sep 9 23:00:51 CEST 2009


Author: reimar
Date: Wed Sep  9 23:00:51 2009
New Revision: 19800

Log:
Add warnings to av_strlcat and av_strlcpy doxygen that the input strings
already must be properly 0-terminated strings, unlike strncpy it
can not be use on raw data read from a file.

Modified:
   trunk/libavutil/avstring.h

Modified: trunk/libavutil/avstring.h
==============================================================================
--- trunk/libavutil/avstring.h	Wed Sep  9 19:27:30 2009	(r19799)
+++ trunk/libavutil/avstring.h	Wed Sep  9 23:00:51 2009	(r19800)
@@ -56,6 +56,10 @@ int av_stristart(const char *str, const 
  * @param src source string
  * @param size size of destination buffer
  * @return the length of src
+ *
+ * WARNING: since the return value is the length of src, src absolutely
+ * _must_ be a properly 0-terminated string, otherwise this will read beyond
+ * the end of the buffer and possibly crash.
  */
 size_t av_strlcpy(char *dst, const char *src, size_t size);
 
@@ -70,6 +74,10 @@ size_t av_strlcpy(char *dst, const char 
  * @param src source string
  * @param size size of destination buffer
  * @return the total length of src and dst
+ *
+ * WARNING: since the return value use the length of src and dst, these absolutely
+ * _must_ be a properly 0-terminated strings, otherwise this will read beyond
+ * the end of the buffer and possibly crash.
  */
 size_t av_strlcat(char *dst, const char *src, size_t size);
 



More information about the ffmpeg-cvslog mailing list