[Asterisk-cvs] asterisk/apps app_voicemail.c,1.39,1.40

martinp at lists.digium.com martinp at lists.digium.com
Fri Nov 21 15:27:35 CST 2003


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

Modified Files:
	app_voicemail.c 
Log Message:
Fix the segfault with duration=atol(NULL)



Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- app_voicemail.c	21 Nov 2003 05:50:21 -0000	1.39
+++ app_voicemail.c	21 Nov 2003 21:53:54 -0000	1.40
@@ -1937,8 +1937,11 @@
 
               /* set callerid and duration variables */
               snprintf(callerid, sizeof(callerid), "FWD from: %s from %s", sender->fullname, ast_variable_retrieve(mif, NULL, "callerid"));
-              duration = atol(ast_variable_retrieve(mif, NULL, "duration"));
-              		
+	      s = ast_variable_retrieve(mif, NULL, "duration");
+              if (s)
+		      duration = atol(s);
+	      else
+		      duration = 0;
 	      if (strlen(receiver->email)) {
 				int attach_user_voicemail = attach_voicemail;
 				char *myserveremail = serveremail;
@@ -1946,7 +1949,7 @@
 					attach_user_voicemail = receiver->attach;
 				if (strlen(receiver->serveremail))
 					myserveremail = receiver->serveremail;
-		      sendmail(myserveremail, receiver, todircount, username, callerid, fn, tmp, atol(ast_variable_retrieve(mif, NULL, "duration")), attach_user_voicemail);
+		      sendmail(myserveremail, receiver, todircount, username, callerid, fn, tmp, duration), attach_user_voicemail);
 	      }
 	     
 			if (strlen(receiver->pager)) {




More information about the svn-commits mailing list