libdvr: LGE Coverity aml dvr report [1/1]
PD#TV-61227
Problem:
LGE report Coverity errors of libdvr.
Solution:
Fix BUFFER_SIZE errors reported by Coverity.
Verify:
Locally tested OK in AH212 RDK environment.
Signed-off-by: Wentao.MA <wentao.ma@amlogic.com>
Change-Id: Ic15f8dee504e940a1a5a183d4e50f85438e7b0c1
diff --git a/src/segment.c b/src/segment.c
index aaffccc..a7d8078 100644
--- a/src/segment.c
+++ b/src/segment.c
@@ -61,6 +61,9 @@
memset(fname, 0, MAX_SEGMENT_PATH_SIZE);
strncpy(fname, location, strlen(location));
offset = strlen(location);
+
+ DVR_ASSERT(offset + DVR_MAX_LOCATION_SIZE < MAX_SEGMENT_PATH_SIZE);
+
if (type != SEGMENT_FILE_TYPE_ALL_DATA) {
strncpy(fname + offset, "-", 1);
offset += 1;