[SVACE-Fix] Fix 376961 / str without termination
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 4 Oct 2018 05:23:35 +0000 (14:23 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Thu, 4 Oct 2018 09:40:31 +0000 (18:40 +0900)
Fixed error: WID:57241610 Copying from string 'label' to 'out_info.data' without null termination at tensordec.c:743 by calling function 'strncpy'.
Reference: https://stackoverflow.com/questions/1453876/why-does-strncpy-not-null-terminate

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
gst/tensor_decoder/tensordec.c

index 33f4c49..a8fbe9d 100644 (file)
@@ -741,6 +741,7 @@ gst_tensordec_label_set_output (GstTensorDec * self, GstBuffer * outbuf,
   g_assert (gst_memory_map (out_mem, &out_info, GST_MAP_WRITE));
 
   strncpy ((char *) out_info.data, label, len);
+  ((char *) out_info.data)[len] = '\0';
 
   gst_buffer_append_memory (outbuf, out_mem);