@@ -439,6 +439,8 @@ std::string PcapNgFileReaderDevice::getOS() const
439439 }
440440
441441 light_pcapng_file_info* fileInfo = light_pcang_get_file_info ((light_pcapng_t *)m_LightPcapNg);
442+ if (fileInfo == nullptr )
443+ return " " ;
442444 char * res = fileInfo->os_desc ;
443445 size_t len = fileInfo->os_desc_size ;
444446 if (len == 0 || res == nullptr )
@@ -456,6 +458,8 @@ std::string PcapNgFileReaderDevice::getHardware() const
456458 }
457459
458460 light_pcapng_file_info* fileInfo = light_pcang_get_file_info ((light_pcapng_t *)m_LightPcapNg);
461+ if (fileInfo == nullptr )
462+ return " " ;
459463 char * res = fileInfo->hardware_desc ;
460464 size_t len = fileInfo->hardware_desc_size ;
461465 if (len == 0 || res == nullptr )
@@ -473,6 +477,8 @@ std::string PcapNgFileReaderDevice::getCaptureApplication() const
473477 }
474478
475479 light_pcapng_file_info* fileInfo = light_pcang_get_file_info ((light_pcapng_t *)m_LightPcapNg);
480+ if (fileInfo == nullptr )
481+ return " " ;
476482 char * res = fileInfo->user_app_desc ;
477483 size_t len = fileInfo->user_app_desc_size ;
478484 if (len == 0 || res == nullptr )
@@ -490,6 +496,8 @@ std::string PcapNgFileReaderDevice::getCaptureFileComment() const
490496 }
491497
492498 light_pcapng_file_info* fileInfo = light_pcang_get_file_info ((light_pcapng_t *)m_LightPcapNg);
499+ if (fileInfo == nullptr )
500+ return " " ;
493501 char * res = fileInfo->file_comment ;
494502 size_t len = fileInfo->file_comment_size ;
495503 if (len == 0 || res == nullptr )
0 commit comments