Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICECUBE_CASCADE last character is not newline #52

Open
athish-thiru opened this issue Oct 7, 2024 · 1 comment
Open

ICECUBE_CASCADE last character is not newline #52

athish-thiru opened this issue Oct 7, 2024 · 1 comment

Comments

@athish-thiru
Copy link
Contributor

There is a general check that the last field of every packet has an ASCII newline character. This check was applied since the newline character should be a standard packet termination character for all notices. This however, does not seem to be the case for ICECUBE_CASCADE notices as trying to generate example.json gives the following error:

AssertionError: Field 39 must be a newline

It seems that the packet simply uses a null character as the termination character:

key = 'ICECUBE_CASCADE'
value = b'\x00\x00\x00\xb0\x00\x00\x00\x01\x00\x00\x00\x00\x00Z\x8a\xe8\x02\r\xf1[\x00\x00O\xe0\x00%\x8ct\x00\x1b\x86\x9a\x00\...96\x00\x00\x00\x00\x00\rq\xcf5042\x00a81\x00\x00\x00\x00eseh406_r_8400nu4931e.4100tv43001864\x00\x0078\x00\x00\x00\x00'
@bob-wiegand
Copy link

Looks like undefined behavior (memory stomping) in fill_amon_event:
https://github.com/nasa-gcn/gcn-classic-notices/blob/4a31bfc77cdd95631bfb175f98d69d599e68b565/src/amon_receiver.c#L9454

  • allowed to pass strncpy up to 44 (11*4) to stay in buf
  • (I guess) the intent was 39 (=10*4 - 1) for a null terminated string inside the documented 10 words
  • I see this is not setting buf[39] = '\n' (and notice the same for some other nearby types)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants