diff --git a/pbx.c b/pbx.c
index 10d8dc0a6f5ccca8d22aa29fb89e25728ebc6be0..f7f1a02053e8371607c759f08b91d1c24ae55711 100755
--- a/pbx.c
+++ b/pbx.c
@@ -5038,7 +5038,8 @@ int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout,
 				if (tmp) {
 					memset(tmp, 0, sizeof(struct app_tmp));
 					strncpy(tmp->app, app, sizeof(tmp->app) - 1);
-					strncpy(tmp->data, appdata, sizeof(tmp->data) - 1);
+					if (appdata)
+						ast_copy_string(tmp->data, appdata, sizeof(tmp->data));
 					tmp->chan = chan;
 					if (sync > 1) {
 						if (locked_channel)