mentebinaria / readpe

The PE file analysis toolkit
GNU General Public License v2.0
676 stars 128 forks source link

fix printing section names that are 8 bytes long #203

Closed gerow closed 11 months ago

gerow commented 11 months ago

pe_section_name accidentally replaces the last character in section names that are 8 bytes long with a NUL. This results in a section header name like .cmdline1 being printed as .cmdlin.

This addresses the off-by-one issue by ensuring we have a NUL at the end of our buffer (which is >= 9 bytes) instead putting it at the byte before the end.