Apply (modified) patch #9552: tftp_cleanup() for cleanup and filename buffer zeroing to prevent filename bugs

... without the memset to zero out the filename
This commit is contained in:
Dirk Ziegelmeier 2018-01-29 06:59:47 +01:00
parent 83ff2014ae
commit 40997c4a08
2 changed files with 11 additions and 0 deletions

View File

@ -412,4 +412,14 @@ tftp_init(const struct tftp_context *ctx)
return ERR_OK;
}
/** @ingroup tftp
* Deinitialize ("turn off") TFTP server.
*/
void tftp_cleanup(void)
{
LWIP_ASSERT("Cleanup called on non-initialized TFTP", tftp_state.upcb != NULL);
udp_remove(tftp_state.upcb);
memset(&tftp_state, 0, sizeof(tftp_state));
}
#endif /* LWIP_UDP */

View File

@ -86,6 +86,7 @@ struct tftp_context {
};
err_t tftp_init(const struct tftp_context* ctx);
void tftp_cleanup(void);
#ifdef __cplusplus
}