milesp20 / intel_nuc_led

Intel NUC7i[x]BN and NUC6CAY LED Control for Linux
GNU General Public License v3.0
88 stars 48 forks source link

Writing behind the allocated memory #26

Open jernst opened 5 years ago

jernst commented 5 years ago

Code excerpt:

input = vmalloc(len);
...
input[len] = '\0';

From https://github.com/milesp20/intel_nuc_led/blob/6a3850eadff554053ca7d95e830a624b28c53670/nuc_led.c#L234

That should be:

input = vmalloc(len+1);
...
input[len] = '\0';
ju2wheels commented 1 year ago

This seems oddly similar to my thoughts on #15 wrt to the null character being added to the output on read but I dont write enough C to chase it down.