[asterisk-commits] branch 1.2 r14462 -
/branches/1.2/apps/app_readfile.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Mar 23 13:13:50 MST 2006
Author: russell
Date: Thu Mar 23 14:13:48 2006
New Revision: 14462
URL: http://svn.digium.com/view/asterisk?rev=14462&view=rev
Log:
don't crash when asked to read from a file that doesn't exist (issue #6786)
Modified:
branches/1.2/apps/app_readfile.c
Modified: branches/1.2/apps/app_readfile.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_readfile.c?rev=14462&r1=14461&r2=14462&view=diff
==============================================================================
--- branches/1.2/apps/app_readfile.c (original)
+++ branches/1.2/apps/app_readfile.c Thu Mar 23 14:13:48 2006
@@ -95,15 +95,16 @@
}
}
- returnvar = ast_read_textfile(file);
- if(len > 0){
- if(len < strlen(returnvar))
- returnvar[len]='\0';
- else
- ast_log(LOG_WARNING,"%s is longer than %d, and %d \n", file, len, (int)strlen(returnvar));
+ if ((returnvar = ast_read_textfile(file))) {
+ if (len > 0) {
+ if (len < strlen(returnvar))
+ returnvar[len]='\0';
+ else
+ ast_log(LOG_WARNING, "%s is longer than %d, and %d \n", file, len, (int)strlen(returnvar));
+ }
+ pbx_builtin_setvar_helper(chan, varname, returnvar);
+ free(returnvar);
}
- pbx_builtin_setvar_helper(chan, varname, returnvar);
- free(returnvar);
LOCAL_USER_REMOVE(u);
return res;
}
More information about the asterisk-commits
mailing list