busybox
Due to a wrong format parameter in a printf httpd does not work when compiled for with the feature LFS (large file support) enabled.
Bug fixed by commit 5cd6461b6fb
| Type | IncompatibleType |
| Config | LFS && (FEATURE_HTTPD_BASIC_AUTH || FEATURE_HTTPD_CGI) (2nd degree) |
| Fix-in | code, mapping |
| Location | networking/ |
#include <stdio.h>
#include <stdlib.h>
#define HTTP_UNAUTHORIZED 401 /* auth needed, respond with auth hdr */
#define HTTP_NOT_IMPLEMENTED 501 /* used for unrecognized requests */
#define HTTP_FORBIDDEN 403
#ifdef CONFIG_FEATURE_HTTPD_CGI
static const char request_GET[] = "GET";
#endif
void sendHeaders(int responseNum)
{
#ifdef CONFIG_LFS
long long total = 10LL;
#else
long total = 10L;
#endif
printf("%ld\r\n", total); //ERROR
}
void handleIncoming(const char *request)
{
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
int random = rand() % 2;
int http_unauthorized = random;
if (http_unauthorized) {
sendHeaders(HTTP_UNAUTHORIZED);
}
#endif
#ifdef CONFIG_FEATURE_HTTPD_CGI
if (request != request_GET) {
sendHeaders(HTTP_NOT_IMPLEMENTED);
}
#endif
}
int main(int argc, char** argv)
{
const char request[] = "POST";
handleIncoming(request);
return 0;
}
diff --git a/simple/5cd6461.c b/simple/5cd6461.c
--- a/simple/5cd6461.c
+++ b/simple/5cd6461.c
@@ -6,6 +6,11 @@
#define HTTP_NOT_IMPLEMENTED 501 /* used for unrecognized requests */
#define HTTP_FORBIDDEN 403
+#ifdef CONFIG_LFS
+#define cont_l_fmt "%lld"
+#else
+#define cont_l_fmt "%ld"
+#endif
#ifdef CONFIG_FEATURE_HTTPD_CGI
static const char request_GET[] = "GET";
@@ -19,7 +24,7 @@
long total = 10L;
#endif
- printf("%ld\r\n", total); //ERROR
+ printf(cont_l_fmt "\r\n", total); //ERROR
}
void handleIncoming(const char *request)
#include <stdio.h>
#include <stdlib.h>
#define HTTP_UNAUTHORIZED 401 /* auth needed, respond with auth hdr */
#define HTTP_NOT_IMPLEMENTED 501 /* used for unrecognized requests */
#define HTTP_FORBIDDEN 403
#ifdef CONFIG_LFS
#define cont_l_fmt "%lld"
#else
#define cont_l_fmt "%ld"
#endif
#ifdef CONFIG_FEATURE_HTTPD_CGI
static const char request_GET[] = "GET";
#endif
int main(int argc, char** argv)
{
const char request[] = "POST";
// handleIncoming(request);
#ifdef CONFIG_LFS
long long total = 10LL;
#else
long total = 10L;
#endif
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
int random = rand() % 2;
int http_unauthorized = random;
if (http_unauthorized) {
printf("%ld\r\n", total); //ERROR
}
#endif
#ifdef CONFIG_FEATURE_HTTPD_CGI
if (request != request_GET)
printf("%ld\r\n", total); //ERROR
#endif
return 0;
}
. call networking/httpd.c:1412:handleIncoming()
.. [FEATURE_HTTPD_BASIC_AUTH] 1583:sendHeaders(HTTP_UNAUTHORIZED); or
.. [FEATURE_HTTPD_CGI] 1611:sendHeaders(HTTP_NOT_IMPLEMENTED);
.. call sendHeaders(int responseNum)
... ERROR 942:len += sprintf("%ld\r\n", config->ContentLength);