From 3f7008e7b8566140183fd19281b3d09cc3965f59 Mon Sep 17 00:00:00 2001
From: Josh Allmann <joshua.allmann@gmail.com>
Date: Mon, 28 Jun 2010 11:39:03 -0700
Subject: [PATCH 1/4] malloc fmtp value

---
 libavformat/rtpdec.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 74858f6..4881832 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -538,8 +538,14 @@ int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p,
                                     char *attr, char *value))
 {
     char attr[256];
-    char value[4096];
+    char *value;
     int res;
+    int value_size = strlen(p);
+
+    if (!(value = av_malloc(value_size))) {
+        av_log(stream, AV_LOG_ERROR, "Failed to allocate data for FMTP.");
+        return AVERROR(ENOMEM);
+    }
 
     // remove protocol identifier
     while (*p && *p == ' ') p++; // strip spaces
@@ -548,11 +554,14 @@ int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p,
 
     while (ff_rtsp_next_attr_and_value(&p,
                                        attr, sizeof(attr),
-                                       value, sizeof(value))) {
+                                       value, value_size)) {
 
         res = parse_fmtp(stream, data, attr, value);
-        if (res < 0)
+        if (res < 0 && res != AVERROR_PATCHWELCOME) {
+            av_free(value);
             return res;
+        }
     }
+    av_free(value);
     return 0;
 }
-- 
1.7.0.4

