Closed kholia closed 2 years ago
Thanks for this! Funny enough I was just debugging the same segfault and was really rising my eyebrows about stpcpy() returning an int. I didn't know the _GNU_SOURCE macro - that's a good find!
The text-based stuff is a huge mess at the moment, sorry for that, I don't like it myself. It's really asking for a rework.
Also I had the segfault issue on ubuntu 18.04 already. It had slipped from me since I quickly checked the stpcpy() code on MacOS only.
Thank you! :)
I am thinking of introducing a debug Makefile with "-g -ggdb -fsanitize=address" in it. It should help us catch bugs early, and really make the decoder solid. We could even fuzz the decoder a bit.
Without these changes, I run into a bunch of problems:
The
stpcpy
doesn't work well at all and returns a truncated pointer (int instead of char *) leading to this crash (segmentation fault) on 64-bit boxes.After this PR,
Things seem to be better.
Since we do
telemetry[18] = '\0'
in the code, thetelemetry
buffer has to be at least 19 bytes.