[FFmpeg-cvslog] rtmpproto: avoid setting auth var value if null

Reynaldo H. Verdejo Pinochet git at videolan.org
Fri May 16 23:39:57 CEST 2014


ffmpeg | branch: master | Reynaldo H. Verdejo Pinochet <r.verdejo at sisa.samsung.com> | Fri May 16 13:22:21 2014 -0400| [e83aae283975ad5657c626912f9f225d7fe673f0] | committer: Reynaldo H. Verdejo Pinochet

rtmpproto: avoid setting auth var value if null

Use default values if parsed variable is found not to
have any value. Avoids crashing at strlen for salt/user
on the auth call afterwards and needless NULL assignments
for the rest (default is already NULL for those).

Should fix Coverity Scan issues #966644 and #966645

Signed-off-by: Reynaldo H. Verdejo Pinochet <r.verdejo at sisa.samsung.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e83aae283975ad5657c626912f9f225d7fe673f0
---

 libavformat/rtmpproto.c |   25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 308110b..b65521b 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -1712,18 +1712,21 @@ static int handle_connect_error(URLContext *s, const char *desc)
         char *value = strchr(ptr, '=');
         if (next)
             *next++ = '\0';
-        if (value)
+        if (value) {
             *value++ = '\0';
-        if (!strcmp(ptr, "user")) {
-            user = value;
-        } else if (!strcmp(ptr, "salt")) {
-            salt = value;
-        } else if (!strcmp(ptr, "opaque")) {
-            opaque = value;
-        } else if (!strcmp(ptr, "challenge")) {
-            challenge = value;
-        } else if (!strcmp(ptr, "nonce")) {
-            nonce = value;
+            if (!strcmp(ptr, "user")) {
+                user = value;
+            } else if (!strcmp(ptr, "salt")) {
+                salt = value;
+            } else if (!strcmp(ptr, "opaque")) {
+                opaque = value;
+            } else if (!strcmp(ptr, "challenge")) {
+                challenge = value;
+            } else if (!strcmp(ptr, "nonce")) {
+                nonce = value;
+            }
+        } else {
+            av_log(s, AV_LOG_WARNING, "Variable %s has NULL value\n", ptr);
         }
         ptr = next;
     }



More information about the ffmpeg-cvslog mailing list