Looking at the source code in https://github.com/cz172638/v4l-utils/blob/master/utils/ir-ctl/ir-ctl.c:

The file-read buffer is in read_file, at line 192:
char line[1024];

and when input is fetched in line 212,

while (fgets(line, sizeof(line), input)) {

the loop assumes that each call returns a complete line. It does *NOT* allow for the possibility that the line is longer than this buffer. (See https://en.cppreference.com/w/c/io/fgets for an illustration of this truncation and continuation.)

The most common fixes can be seen at https://wiki.sei.cmu.edu/confluence/pages/viewpage.action?pageId=87152445 Note that using the POSIX getline() function instead of fgets() automagically deals with this for you (though it does put the buffer in the heap rather than on the stack, so you're responsible for free()ing it).

Is that sufficient to get this fixed, or do you need me to submit a formal pull request?

--
  /_  Joe Kesselman (he/him/his)
-/ _) My Alexa skill for New Music/New Sounds fans:
  /   https://www.amazon.com/dp/B09WJ3H657/

() Plaintext Ribbon Campaign
/\ Stamp out HTML mail!

Reply via email to