@@ -197,6 +197,7 @@ static int sndk_do_cap_both_telemetry_log(struct nvme_global_ctx *ctx,
197197
198198 /* Remove .tar extension if present */
199199 char * tar_ext = strstr (base_name , ".tar" );
200+
200201 if (tar_ext )
201202 * tar_ext = '\0' ;
202203
@@ -393,7 +394,7 @@ static int sndk_vs_internal_fw_log(int argc, char **argv,
393394 "Output file size. Deprecated, see man page for supported devices." ;
394395 const char * offset =
395396 "Output file data offset. Deprecated, see man page for supported devices." ;
396- char f [PATH_MAX ] = {0 };
397+ char f [PATH_MAX - 4 ] = {0 };
397398 char fileSuffix [PATH_MAX ] = {0 };
398399 __u32 xfer_size = 0 ;
399400 int telemetry_type = 0 , telemetry_data_area = 0 ;
@@ -463,7 +464,7 @@ static int sndk_vs_internal_fw_log(int argc, char **argv,
463464 }
464465 close (verify_file );
465466 remove (cfg .file );
466- strncpy (f , cfg .file , PATH_MAX - 1 );
467+ strncpy (f , cfg .file , PATH_MAX - 5 );
467468 } else {
468469 sndk_UtilsGetTime (& timeInfo );
469470 memset (timeStamp , 0 , sizeof (timeStamp ));
@@ -534,11 +535,13 @@ static int sndk_vs_internal_fw_log(int argc, char **argv,
534535 if (telemetry_type == SNDK_TELEMETRY_TYPE_BOTH ) {
535536 /* For BOTH type, ensure filename has .tar extension */
536537 char tar_file [PATH_MAX ] = {0 };
538+
537539 if (strstr (f , ".tar" ) == NULL ) {
538540 char * bin_ext = strstr (f , ".bin" );
539- if (bin_ext ) {
541+
542+ if (bin_ext )
540543 * bin_ext = '\0' ;
541- }
544+
542545 snprintf (tar_file , PATH_MAX , "%s.tar" , f );
543546 } else {
544547 snprintf (tar_file , PATH_MAX , "%s" , f );
0 commit comments