[En-Nut-Discussion] bug in Enhanced HTTP

Piotr Szlachta pszlachta at supermedia.pl
Thu Nov 22 14:52:32 CET 2007


Hi

Httpd.c, NutHttpProcessFileRequest,  line no 613


n = _read(fd, data, size);
if (fwrite(data, 1, n, stream) == 0) break;


Error returned by _read(fd, data, size); is no handled. 
When _read return -1 fwrite will crush Nut.


Quick fix is:

n = _read(fd, data, size);
if (n<0) break;
if (fwrite(data, 1, n, stream) == 0) break;



I think we should report server internal error here.

BTW, 
I discovered this error thanks to _fake_ Kingston MMC. 
I can't read certain sectors on this card.


Regards
Piotr.




More information about the En-Nut-Discussion mailing list