6
0
Fork 0

kcpuproc.cpp - prevent overflow #2

Geschlossen
vor 6 Jahren geöffnet von Ghost · 2 Kommentare
Ghost hat vor 6 Jahren kommentiert

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 hat vor 6 Jahren kommentiert
Besitzer

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 hat diesen Issue vor 6 Jahren zum R14.0.6 release Meilenstein hinzugefügt
SlavekB hat vor 6 Jahren kommentiert
Besitzer

Fixed by PR #4, commit e816bb8048.

Fixed by PR #4, commit e816bb8048.
SlavekB hat diesen Issue vor 6 Jahren geschlossen
Anmelden, um an der Diskussion teilzunehmen.
Kein Meilenstein
Niemand zuständig
3 Beteiligte
Nachrichten
Fällig am

Kein Fälligkeitsdatum gesetzt.

Abhängigkeiten

Keine Abhängigkeiten gesetzt.

Referenz: TDE/kcpuload#2
Laden…
Hier gibt es bis jetzt noch keinen Inhalt.