diff --git a/doc/APIchanges b/doc/APIchanges
index c5a10003469644e3fe7295f89441dccecca366b6..067f60ffbf57c41aa6b9ce86471685431fb4b107 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil:     2014-08-09
 
 API changes, most recent first:
 
+2014-08-xx - xxxxxxx - lavu 54.03.0 - mem.h
+  Add av_strndup().
+
 2014-xx-xx - xxxxxxx - lavu 54.02.0 - opt.h
   Add av_opt_get_dict_val/set_dict_val with AV_OPT_TYPE_DICT to support
   dictionary types being set as options.
diff --git a/libavutil/mem.c b/libavutil/mem.c
index 8226168eedc62ed002c6328653e2fd4b1ec6a9ef..35a82e8a2dfb09fb88e3b583ce9eca7ef8b3417a 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -267,6 +267,26 @@ char *av_strdup(const char *s)
     return ptr;
 }
 
+char *av_strndup(const char *s, size_t len)
+{
+    char *ret = NULL, *end;
+
+    if (!s)
+        return NULL;
+
+    end = memchr(s, 0, len);
+    if (end)
+        len = end - s;
+
+    ret = av_realloc(NULL, len + 1);
+    if (!ret)
+        return NULL;
+
+    memcpy(ret, s, len);
+    ret[len] = 0;
+    return ret;
+}
+
 void *av_memdup(const void *p, size_t size)
 {
     void *ptr = NULL;
diff --git a/libavutil/mem.h b/libavutil/mem.h
index 0be2127071cb7240449b024f95ba468f7483d3d9..2a1e36d69fb5395af62e5dcdf16f9f453f1ab41d 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -240,6 +240,16 @@ av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t si
  */
 char *av_strdup(const char *s) av_malloc_attrib;
 
+/**
+ * Duplicate a substring of the string s.
+ * @param s string to be duplicated
+ * @param len the maximum length of the resulting string (not counting the
+ *            terminating byte).
+ * @return Pointer to a newly-allocated string containing a
+ * copy of s or NULL if the string cannot be allocated.
+ */
+char *av_strndup(const char *s, size_t len) av_malloc_attrib;
+
 /**
  * Duplicate the buffer p.
  * @param p buffer to be duplicated
diff --git a/libavutil/version.h b/libavutil/version.h
index 43114c7899a41029d591f6ac0daf0a2cc64c4792..f5b92778e2031a2173bda1b826197dfbef1d2a89 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -56,7 +56,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  54
-#define LIBAVUTIL_VERSION_MINOR   2
+#define LIBAVUTIL_VERSION_MINOR   3
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \