lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] SMTP base64 patch, HTTPD question.


From: Ben Whitten
Subject: [lwip-devel] SMTP base64 patch, HTTPD question.
Date: Thu, 23 May 2013 09:22:17 +0100

Hey,

This generates working userpass auth strings. Tested with GMX, Lavabit, Aol, Plusnet, and Yahoo. With various username/password sizes.

I am also hunting a bug in the httpserver_raw, when including SSI tags; it finds the tag, sends the preceding data, then the tag. But then the sending length is never reset so it sends the remaining page at the tag length.
As a result serving a webpage takes 2-3 seconds if its a 4K file with an SSI tag in the <title>.
The problem seems to be around :1351 where I think len is being mistaken for something else, where its actually the length of the previously sent section (last tag length). Could someone more familiar with the code take a look too?

Thanks,
Ben Whitten

--- C:/Users/bwhitten/Desktop/contrib-1.4.1/apps/smtp/smtp.c    Mon Dec 17 19:03:22 2012
+++ C:/Users/bwhitten/Desktop/contrib-1.4.1/apps/smtp/smtp - Copy.c    Thu May 23 08:51:16 2013
@@ -804,8 +804,8 @@
   s8_t j;
   size_t target_idx = 0;
   size_t longer = 3 - (source_len % 3);
-  size_t source_len_b64 = source_len + longer;
-  size_t len = (((source_len_b64) * 4) / 3);
+  size_t source_len_b64 = source_len + ((longer != 3) ? longer : 0);
+  size_t len = (((source_len_b64 / 3) * 4));
   u8_t x = 5;
   u8_t current = 0;
   LWIP_UNUSED_ARG(target_len);
@@ -824,7 +824,7 @@
       }
     }
   }
-  for (i = len - longer; i < len; i++) {
+  for (i = len - ((longer != 3) ? longer : 0); i < len; i++) {
     target[i] = '=';
   }
   return len;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]