[Asterisk-cvs] asterisk/apps app_dial.c,1.53.2.2,1.53.2.3

citats at lists.digium.com citats at lists.digium.com
Thu Feb 26 23:35:41 CST 2004


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv10665/apps

Modified Files:
      Tag: v1-0_stable
	app_dial.c 
Log Message:
Check result of malloc in app_dial.c



Index: app_dial.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_dial.c,v
retrieving revision 1.53.2.2
retrieving revision 1.53.2.3
diff -u -d -r1.53.2.2 -r1.53.2.3
--- app_dial.c	22 Feb 2004 05:32:40 -0000	1.53.2.2
+++ app_dial.c	27 Feb 2004 04:24:57 -0000	1.53.2.3
@@ -207,13 +207,19 @@
 							if (o->chan->callerid)
 								free(o->chan->callerid);
 							o->chan->callerid = malloc(strlen(in->callerid) + 1);
-							strncpy(o->chan->callerid, in->callerid, strlen(in->callerid) + 1);
+							if (o->chan->callerid)
+								strncpy(o->chan->callerid, in->callerid, strlen(in->callerid) + 1);
+							else
+								ast_log(LOG_WARNING, "Out of memory\n");
 						}
 						if (in->ani) {
 							if (o->chan->ani)
 								free(o->chan->ani);
 							o->chan->ani = malloc(strlen(in->ani) + 1);
-							strncpy(o->chan->ani, in->ani, strlen(in->ani) + 1);
+							if (o->chan->ani)
+								strncpy(o->chan->ani, in->ani, strlen(in->ani) + 1);
+							else
+								ast_log(LOG_WARNING, "Out of memory\n");
 						}
 						if (ast_call(o->chan, tmpchan, 0)) {
 							ast_log(LOG_NOTICE, "Failed to dial on local channel for call forward to '%s'\n", tmpchan);




More information about the svn-commits mailing list