1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -05:00

DSD demod: fixed possible buffer overrun with sprintf

This commit is contained in:
f4exb 2017-05-06 12:24:57 +02:00
parent 15443fb72d
commit 62cbcc3083

View File

@ -510,7 +510,7 @@ void DSDDemodGUI::formatStatusText()
}
memcpy(&m_formatStatusText[41], m_dsdDemod->getDecoder().getDStarDecoder().getInfoText(), 20);
memcpy(&m_formatStatusText[62], m_dsdDemod->getDecoder().getDStarDecoder().getLocator(), 6);
sprintf(&m_formatStatusText[69], "%03d/%07.1f",
snprintf(&m_formatStatusText[69], 82-69, "%03d/%07.1f",
m_dsdDemod->getDecoder().getDStarDecoder().getBearing(),
m_dsdDemod->getDecoder().getDStarDecoder().getDistance());
}
@ -519,7 +519,7 @@ void DSDDemodGUI::formatStatusText()
m_signalFormat = signalFormatDStar;
break;
case DSDcc::DSDDecoder::DSDSyncDPMR:
sprintf(m_formatStatusText, "%s CC: %04d OI: %08d CI: %08d",
snprintf(m_formatStatusText, 82, "%s CC: %04d OI: %08d CI: %08d",
DSDcc::DSDdPMR::dpmrFrameTypes[(int) m_dsdDemod->getDecoder().getDPMRDecoder().getFrameType()],
m_dsdDemod->getDecoder().getDPMRDecoder().getColorCode(),
m_dsdDemod->getDecoder().getDPMRDecoder().getOwnId(),