Fix segfault due to calling strlen on null payload.
Fix segfault due to calling strlen on null payload.

Some messages like ACKs, RESETs and others have null payload.
strlen was called in the function args which caused a seg fault.
Added check for null before calling strlen and moved call outside of
args list.

Change-Id: Ia97d48e662c220f73eec56bd260ed1f6c94dab90
Signed-off-by: Mandeep Shetty <9576c34ab780cbbd29c2639a47eb90b07da66bfe@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/979
Reviewed-by: Erich Keane <ec9f61fe526c14bb62c55d7c978f025ee6b3583d@intel.com>
Tested-by: jenkins-iotivity <09cb29e8a2b473a2c978382eec13ee06fa017bda@opendaylight.org>

tienfuc/iotivity-democlient-snap,santais/iotivity_1.1.0,iotivity/iotivity,iotivity/iotivity,tienfuc/iotivity-democlient-snap,iotivity/iotivity,santais/iotivity,santais/iotivity,kartben/iotivity,santais/iotivity_1.1.0,santais/iotivity_1.1.0,santais/iotivity_1.1,tienfuc/iotivity-democlient-snap,kartben/iotivity,tienfuc/iotivity-democlient-snap,santais/iotivity_1.1.0,iotivity/iotivity,kartben/iotivity,kartben/iotivity,santais/iotivity_1.1,WojciechLuczkow/iotivity,WojciechLuczkow/iotivity,santais/iotivity_1.1,iotivity/iotivity,rzr/iotivity,santais/iotivity_1.1,rzr/iotivity,kartben/iotivity,WojciechLuczkow/iotivity,rzr/iotivity,rzr/iotivity,santais/iotivity_1.1,santais/iotivity_1.1.0,santais/iotivity,tienfuc/iotivity-democlient-snap,santais/iotivity_1.1,WojciechLuczkow/iotivity,rzr/iotivity,tienfuc/iotivity-democlient-snap,santais/iotivity,tienfuc/iotivity-democlient-snap,santais/iotivity,tienfuc/iotivity-democlient-snap,iotivity/iotivity,santais/iotivity_1.1,WojciechLuczkow/iotivity,rzr/iotivity,tienfuc/iotivity-democlient-snap,iotivity/iotivity,santais/iotivity_1.1.0,santais/iotivity,WojciechLuczkow/iotivity,santais/iotivity_1.1,kartben/iotivity,santais/iotivity,tienfuc/iotivity-democlient-snap,kartben/iotivity,rzr/iotivity,kartben/iotivity,iotivity/iotivity,santais/iotivity_1.1.0,WojciechLuczkow/iotivity,WojciechLuczkow/iotivity