Browse code

ffserver_config: check strchr() return for NULL

Should fix FFmpeg Coverity Scan issue #1257013

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

Reynaldo H. Verdejo Pinochet authored on 2014/12/09 00:42:39
Showing 1 changed files
... ...
@@ -520,7 +520,13 @@ static int ffserver_save_avoption(const char *opt, const char *arg, int type, FF
520 520
         //explicit private option
521 521
         snprintf(buff, sizeof(buff), "%s", opt);
522 522
         codec_name = buff;
523
-        option = strchr(buff, ':');
523
+        if(!(option = strchr(buff, ':'))){
524
+            report_config_error(config->filename, config->line_num,
525
+                                AV_LOG_ERROR, &config->errors,
526
+                                "Syntax error. Unmatched ':'\n");
527
+            return -1;
528
+
529
+        }
524 530
         buff[option - buff] = '\0';
525 531
         option++;
526 532
         if ((ret = ffserver_set_codec(ctx, codec_name, config)) < 0)