From f6bb68fd566f93086118e84c41e3edca902d5334 Mon Sep 17 00:00:00 2001
From: Tilghman Lesher <tilghman@meg.abyt.es>
Date: Wed, 5 Mar 2008 17:40:42 +0000
Subject: [PATCH] Should check these values for non-NULL before scanning.
 (Closes issue #12147)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106139 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 apps/app_talkdetect.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/apps/app_talkdetect.c b/apps/app_talkdetect.c
index 0aa5e818b5..fb862440dd 100644
--- a/apps/app_talkdetect.c
+++ b/apps/app_talkdetect.c
@@ -83,11 +83,11 @@ static int background_detect_exec(struct ast_channel *chan, void *data)
 	tmp = ast_strdupa(data);
 	AST_STANDARD_APP_ARGS(args, tmp);
 
-	if ((sscanf(args.silence, "%d", &x) == 1) && (x > 0))
+	if (!ast_strlen_zero(args.silence) && (sscanf(args.silence, "%d", &x) == 1) && (x > 0))
 		sil = x;
-	if ((sscanf(args.min, "%d", &x) == 1) && (x > 0))
+	if (!ast_strlen_zero(args.min) && (sscanf(args.min, "%d", &x) == 1) && (x > 0))
 		min = x;
-	if ((sscanf(args.max, "%d", &x) == 1) && (x > 0))
+	if (!ast_strlen_zero(args.max) && (sscanf(args.max, "%d", &x) == 1) && (x > 0))
 		max = x;
 
 	ast_debug(1, "Preparing detect of '%s', sil=%d, min=%d, max=%d\n", args.filename, sil, min, max);
-- 
GitLab