kcpuproc.cpp - prevent overflow #2

닫힘
opened 6 년 전 by Ghost · 2개의 코멘트
Ghost 코멘트됨, 6 년 전

I've run cppcheck on kcpuload, here is the error:

[kcpuproc.cpp:176]: (error) Width 32 given in format string (no. 1) is larger than destination buffer 'tagbuffer[32]', use %31s to prevent overflowing it.

Instead, I'd like to enlarge the 'tagbuffer' array by 1, but I have no ideas why the guy has set the string to 32 characters.

What do think about?

I've run cppcheck on kcpuload, here is the error: [kcpuproc.cpp:176]: (error) Width 32 given in format string (no. 1) is larger than destination buffer 'tagbuffer[32]', use %31s to prevent overflowing it. Instead, I'd like to enlarge the 'tagbuffer' array by 1, but I have no ideas why the guy has set the string to 32 characters. What do think about?
MicheleC 코멘트됨, 6 년 전
소유자

Hi Greg,

yes, increasing the tagbugger to 33 bytes is the correct solution.

Changing the sequence of reading in the fscanf may lead to unexpected results, with bytes after 32 being shifted by one. Extending tagbuffer to allow for the extra null terminator will preserve functionality and avoid mistakes.

Good work!

Hi Greg, yes, increasing the tagbugger to 33 bytes is the correct solution. Changing the sequence of reading in the fscanf may lead to unexpected results, with bytes after 32 being shifted by one. Extending tagbuffer to allow for the extra null terminator will preserve functionality and avoid mistakes. Good work!
SlavekB R14.0.6 release 6 년 전 마일스톤을 추가하였습니다.
SlavekB 코멘트됨, 6 년 전
소유자

Fixed by PR #4, commit e816bb8048.

Fixed by PR #4, commit e816bb8048.
SlavekB closed this issue 6 년 전
로그인하여 이 대화에 참여
마일스톤 없음
담당자 없음
참여자 3명
알림
마감일

마감일이 설정되지 않았습니다.

의존성

No dependencies set.

Reference: TDE/kcpuload#2
불러오는 중...
아직 콘텐츠가 없습니다.