Valgrind report invalid read of size 1
Brought to you by:
techentin
Thanks for the amazing library you wrote!!!
I think I found a small memory issue in it. I get from
valgrind (http://valgrind.org/) many:
==25666==
==25666== Invalid read of size 1
==25666== at 0x1B902586: strcmp
(mac_replace_strmem.c:332)
==25666== by 0x80499FE: reduceUnit (units.c:641)
==25666== by 0x8049231: units_convert (units.c:373)
I _think_ the fix should be in line 641 of units.c:
if (pos >= 0 && strcmp(subunit+pos,up1->name) == 0 ) {
So pos must be non negative (otherwise you check
address before the start of subunit).
Rani