changeset 778:81aecbb6bbb2 libavutil

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.
author reimar
date Wed, 09 Sep 2009 21:00:51 +0000
parents 9b87c6b537bb
children a0b16768a2f0
files avstring.h
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/avstring.h	Sun Sep 06 00:08:19 2009 +0000
+++ b/avstring.h	Wed Sep 09 21:00:51 2009 +0000
@@ -56,6 +56,10 @@
  * @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 @@
  * @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);