OSDN Git Service

ffserver_config: check strchr() return for NULL
authorReynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
Mon, 8 Dec 2014 15:42:39 +0000 (12:42 -0300)
committerReynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
Tue, 9 Dec 2014 04:03:01 +0000 (01:03 -0300)
Should fix FFmpeg Coverity Scan issue #1257013

Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
ffserver_config.c

index ccc35d7..51e3f49 100644 (file)
@@ -520,7 +520,13 @@ static int ffserver_save_avoption(const char *opt, const char *arg, int type, FF
         //explicit private option
         snprintf(buff, sizeof(buff), "%s", opt);
         codec_name = buff;
-        option = strchr(buff, ':');
+        if(!(option = strchr(buff, ':'))){
+            report_config_error(config->filename, config->line_num,
+                                AV_LOG_ERROR, &config->errors,
+                                "Syntax error. Unmatched ':'\n");
+            return -1;
+
+        }
         buff[option - buff] = '\0';
         option++;
         if ((ret = ffserver_set_codec(ctx, codec_name, config)) < 0)