mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 03:50:31 +00:00
issue #5560
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6934 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
2005-11-01 Kevin P. Fleming <kpfleming@digium.com>
|
||||
|
||||
* apps/app_cut.c (cut_internal): use ast_separate_app_args() instead of open code (issue #5560)
|
||||
|
||||
* apps/app_mixmonitor.c (launch_monitor_thread): ast_strlen_zero can handle NULL input (issue #5561)
|
||||
(mixmonitor_exec): same
|
||||
|
||||
|
@@ -36,6 +36,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#include "asterisk/pbx.h"
|
||||
#include "asterisk/module.h"
|
||||
#include "asterisk/version.h"
|
||||
#include "asterisk/app.h"
|
||||
|
||||
/* Maximum length of any variable */
|
||||
#define MAXRESULT 1024
|
||||
@@ -150,7 +151,7 @@ static int sort_internal(struct ast_channel *chan, char *data, char *buffer, siz
|
||||
|
||||
static int cut_internal(struct ast_channel *chan, char *data, char *buffer, size_t buflen)
|
||||
{
|
||||
char *s, *varname=NULL, *delimiter=NULL, *field=NULL;
|
||||
char *s, *args[3], *varname=NULL, *delimiter=NULL, *field=NULL;
|
||||
int args_okay = 0;
|
||||
|
||||
memset(buffer, 0, buflen);
|
||||
@@ -159,15 +160,13 @@ static int cut_internal(struct ast_channel *chan, char *data, char *buffer, size
|
||||
if (data) {
|
||||
s = ast_strdupa((char *)data);
|
||||
if (s) {
|
||||
varname = strsep(&s, "|");
|
||||
if (varname && (varname[0] != '\0')) {
|
||||
delimiter = strsep(&s, "|");
|
||||
if (delimiter) {
|
||||
field = strsep(&s, "|");
|
||||
if (field) {
|
||||
args_okay = 1;
|
||||
}
|
||||
}
|
||||
ast_separate_app_args(s, '|', args, 3);
|
||||
varname = args[0];
|
||||
delimiter = args[1];
|
||||
field = args[2];
|
||||
|
||||
if (field) {
|
||||
args_okay = 1;
|
||||
}
|
||||
} else {
|
||||
return ERROR_NOMEM;
|
||||
|
Reference in New Issue
Block a user