lkundrak / dev86

C compiler, assembler and linker environment for the production of 8086 executables
http://v3.sk/~lkundrak/dev86/
GNU General Public License v2.0
153 stars 44 forks source link

ar: prevent buffer overflow on archive creation #24

Closed sraase closed 2 years ago

sraase commented 2 years ago

The ar_hdr fields in header_from_map() are written with sprintf(), which may overflow the field lengths on some systems, causing ar86 to crash:

buffer overflow detected : ar86 terminated

Use snprintf instead to prevent the buffer overflow.