szpajder / libacars

A library for decoding various ACARS message payloads
MIT License
116 stars 20 forks source link

Media Advisory frame with too many available link indicators results in unterminated string #9

Closed mmiszewski closed 3 years ago

mmiszewski commented 3 years ago

Parsing of Media Advisory frame with 10 or more available link indicators results in unterminated string available_links in la_media_adv_msg struct (missing \0). This can lead to unexpected (and potentially funny) program behavior when the string is used later in the program.

For example, in decode_acars_apps it causes reading past end of the buffer, until next null character is found (which is at the end of text string). This results in parsing the whole message as letter codes of available links and printing them as a long list.

Example that illustrates the problem:

./decode_acars_apps d SA '0EV123456VVVVVVVVVV/HERE IS THE TEXT MESSAGE THAT IS NOT A LIST OF AVAILABLE LINKS'
szpajder commented 3 years ago

Fixed in unstable.

mmiszewski commented 3 years ago

Tested, works as intended.