From 83c7cc45daf6fb1f8c36f15297a4657e45a34e88 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Sun, 23 Sep 2012 02:51:16 +0200 Subject: Fix undefined behavior caused by referencing the returned buffer by std::string::c_str() when the object is temporary Thanks to @ChrisTX for pointing this out Fixes #257 reported by @helloall --- src/modules/m_httpd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/modules/m_httpd.cpp') diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 0584e97c5..bf86c9091 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -282,7 +282,7 @@ class HttpServerSocket : public BufferedSocket return; } - if (headers.IsSet("Content-Length") && (postsize = atoi(headers.GetHeader("Content-Length").c_str())) != 0) + if (headers.IsSet("Content-Length") && (postsize = ConvToInt(headers.GetHeader("Content-Length"))) != 0) { InternalState = HTTP_SERVE_RECV_POSTDATA; -- cgit v1.3.1-10-gc9f91