Public bug reported:

Steps to reproduce:

$ printf "GET https://ip.pr1v.net/ HTTP/1.0\r\n\r\n" | ./micro_proxy 
HTTP/1.0 400 Bad Request
Server: micro_proxy
Segmentation fault


$ printf "GET http://incorrect.address.00000/ HTTP/1.0\r\n\r\n" | ./micro_proxy 
HTTP/1.0 404 Not Found
Server: micro_proxy
Segmentation fault


Fix:

diff --git a/micro_proxy.c b/micro_proxy.c
index 78e317f..3d6c144 100644
--- a/micro_proxy.c
+++ b/micro_proxy.c
@@ -38,6 +38,8 @@
 #include <netdb.h>
 #include <fcntl.h>
 #include <syslog.h>
+#include <time.h>


After fix:

$ printf "GET http://incorrect.address.00000/ HTTP/1.0\r\n\r\n" | ./micro_proxy 
HTTP/1.0 404 Not Found
Server: micro_proxy
Date: Mon, 28 May 2018 13:11:48 GMT
Content-Type: text/html
Connection: close

<HTML>
<HEAD><TITLE>404 Not Found</TITLE></HEAD>
<BODY BGCOLOR="#cc9999" TEXT="#000000" LINK="#2020ff" VLINK="#4040cc">
<H4>404 Not Found</H4>
Unknown host.
<HR>
<ADDRESS><A 
HREF="http://www.acme.com/software/micro_proxy/";>micro_proxy</A></ADDRESS>
</BODY>
</HTML>


$ printf "GET https://ip.pr1v.net/ HTTP/1.0\r\n\r\n" | ./micro_proxy 
HTTP/1.0 400 Bad Request
Server: micro_proxy
Date: Mon, 28 May 2018 13:12:02 GMT
Content-Type: text/html
Connection: close

<HTML>
<HEAD><TITLE>400 Bad Request</TITLE></HEAD>
<BODY BGCOLOR="#cc9999" TEXT="#000000" LINK="#2020ff" VLINK="#4040cc">
<H4>400 Bad Request</H4>
Unknown URL type.
<HR>
<ADDRESS><A 
HREF="http://www.acme.com/software/micro_proxy/";>micro_proxy</A></ADDRESS>
</BODY>
</HTML>

** Affects: micro-proxy (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1773802

Title:
  program crashes with "Segmentation Fault" in multiple situations
  because of missing time.h header

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/micro-proxy/+bug/1773802/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to