From 0587941bb939fa46843917740f2c652a4219911f Mon Sep 17 00:00:00 2001 From: neurolabusc Date: Wed, 23 Dec 2020 09:43:16 -0500 Subject: [PATCH] Overflow for Siemens data [missing protocol name] (https://github.com/rordenlab/dcm2niix/issues/466) --- console/nii_dicom.h | 2 +- console/nii_dicom_batch.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/console/nii_dicom.h b/console/nii_dicom.h index c31a24a9..cdfbeb05 100644 --- a/console/nii_dicom.h +++ b/console/nii_dicom.h @@ -50,7 +50,7 @@ extern "C" { #define kCPUsuf " " //unknown CPU #endif -#define kDCMdate "v1.0.20201223" +#define kDCMdate "v1.0.20201224" #define kDCMvers kDCMdate " " kJP2suf kLSsuf kCCsuf kCPUsuf static const int kMaxEPI3D = 1024; //maximum number of EPI images in Siemens Mosaic diff --git a/console/nii_dicom_batch.cpp b/console/nii_dicom_batch.cpp index bf6695ab..8473eb06 100644 --- a/console/nii_dicom_batch.cpp +++ b/console/nii_dicom_batch.cpp @@ -968,6 +968,8 @@ void rescueProtocolName(struct TDICOMdata *d, const char * filename) { char protocolName[kDICOMStrLarge], fmriExternalInfo[kDICOMStrLarge], coilID[kDICOMStrLarge], consistencyInfo[kDICOMStrLarge], coilElements[kDICOMStrLarge], pulseSequenceDetails[kDICOMStrLarge], wipMemBlock[kDICOMStrLarge]; TCsaAscii csaAscii; siemensCsaAscii(filename, &csaAscii, d->CSA.SeriesHeader_offset, d->CSA.SeriesHeader_length, shimSetting, coilID, consistencyInfo, coilElements, pulseSequenceDetails, fmriExternalInfo, protocolName, wipMemBlock); + if (strlen(protocolName) >= kDICOMStr) + protocolName[kDICOMStr-1] = 0; strcpy(d->protocolName, protocolName); #endif }