[En-Nut-Discussion] Enhanced HTTP Daemon Memory Hole

Harald Kipp harald.kipp at egnite.de
Wed Nov 7 18:08:10 CET 2007


The enhanced HTTP demo published at

http://www.ethernut.de/en/documents/httpd-enhanced.html

contains a memory hole. The character buffer filename in 
NutHttpProcessFileRequest() is never released.

To fix this, release the buffer after the call to NutGetMimeHandler:

    handler = NutGetMimeHandler(filename);
    free(filename);

Note, that it must not be released at

    if (fd == -1) {
        NutHttpSendError(stream, req, 404);
        return;
    }

several lines above.


Harald




More information about the En-Nut-Discussion mailing list