summaryrefslogtreecommitdiff
path: root/src/console/dlt-convert.c
diff options
context:
space:
mode:
authorBui Nguyen Quoc Thanh <49302843+thanhbnq@users.noreply.github.com>2022-07-07 11:00:34 +0700
committerGitHub <noreply@github.com>2022-07-07 11:00:34 +0700
commit855e0017a980d2990c16f7dbf3b4983b48fac272 (patch)
treeb7019f1e75d74d1361d6718cb78ad20524ac865c /src/console/dlt-convert.c
parentba26a823e8f4dbde70b30bce9744f3b8fa340fce (diff)
downloadDLT-daemon-855e0017a980d2990c16f7dbf3b4983b48fac272.tar.gz
Fix handle returned value (#384)
* common: Handle returned value - The returned value of supporting APIs should be checked correctly. - In case of extended header, the buffer of header must be checked before proceeding further. Signed-off-by: Bui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com> * console: Handle returned value In case of parsing dlt file, the failed messages should be skipped by evaluating returned value Signed-off-by: Bui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>
Diffstat (limited to 'src/console/dlt-convert.c')
-rw-r--r--src/console/dlt-convert.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/console/dlt-convert.c b/src/console/dlt-convert.c
index b82c104..30ea09a 100644
--- a/src/console/dlt-convert.c
+++ b/src/console/dlt-convert.c
@@ -432,31 +432,37 @@ int main(int argc, char *argv[])
}
for (num = begin; num <= end; num++) {
- dlt_file_message(&file, num, vflag);
+ if (dlt_file_message(&file, num, vflag) < DLT_RETURN_OK)
+ continue;
if (xflag) {
printf("%d ", num);
- dlt_message_print_hex(&(file.msg), text, DLT_CONVERT_TEXTBUFSIZE, vflag);
+ if (dlt_message_print_hex(&(file.msg), text, DLT_CONVERT_TEXTBUFSIZE, vflag) < DLT_RETURN_OK)
+ continue;
}
else if (aflag) {
printf("%d ", num);
- dlt_message_header(&(file.msg), text, DLT_CONVERT_TEXTBUFSIZE, vflag);
+ if (dlt_message_header(&(file.msg), text, DLT_CONVERT_TEXTBUFSIZE, vflag) < DLT_RETURN_OK)
+ continue;
printf("%s ", text);
- dlt_message_payload(&file.msg, text, DLT_CONVERT_TEXTBUFSIZE, DLT_OUTPUT_ASCII, vflag);
+ if (dlt_message_payload(&file.msg, text, DLT_CONVERT_TEXTBUFSIZE, DLT_OUTPUT_ASCII, vflag) < DLT_RETURN_OK)
+ continue;
printf("[%s]\n", text);
}
else if (mflag) {
printf("%d ", num);
- dlt_message_print_mixed_plain(&(file.msg), text, DLT_CONVERT_TEXTBUFSIZE, vflag);
+ if (dlt_message_print_mixed_plain(&(file.msg), text, DLT_CONVERT_TEXTBUFSIZE, vflag) < DLT_RETURN_OK)
+ continue;
}
else if (sflag) {
printf("%d ", num);
- dlt_message_header(&(file.msg), text, DLT_CONVERT_TEXTBUFSIZE, vflag);
+ if (dlt_message_header(&(file.msg), text, DLT_CONVERT_TEXTBUFSIZE, vflag) < DLT_RETURN_OK)
+ continue;
printf("%s \n", text);
}