It's a nice idea but the C portion expects an array of unknown size, no bounds checking possible at all and it's also not returned how large the PNM image is. I also don't understand why glib is needed here to get the array to work. It's also missing the stdint.h include to be able to use uint8_t.