summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2009-12-02 11:00:17 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2009-12-02 11:00:17 +0000
commit65c3dca4ba411c190d4ab973ebed5f7b389f4868 (patch)
tree664a1bfa4fa1bcf4e10380878feb69576afa39cf /cpukit
parent2009-12-02 Ralf Corsépius <ralf.corsepius@rtems.org> (diff)
downloadrtems-65c3dca4ba411c190d4ab973ebed5f7b389f4868.tar.bz2
2009-12-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* shttpd/def.h: Shrink default URI_MAX to 32767. Add special cases for sizeof(size_t) < 2.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/ChangeLog5
-rw-r--r--cpukit/shttpd/defs.h20
2 files changed, 25 insertions, 0 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index e41e44c21c..9664097878 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-02 Ralf Corsépius <ralf.corsepius@rtems.org>
+
+ * shttpd/def.h: Shrink default URI_MAX to 32767.
+ Add special cases for sizeof(size_t) < 2.
+
2009-12-01 Joel Sherrill <joel.sherrill@OARcorp.com>
* libmisc/stringto/stringto.h, libmisc/stringto/stringto_template.h:
diff --git a/cpukit/shttpd/defs.h b/cpukit/shttpd/defs.h
index fef5ecefc4..6956ebe113 100644
--- a/cpukit/shttpd/defs.h
+++ b/cpukit/shttpd/defs.h
@@ -34,7 +34,27 @@
#define EXPIRE_TIME 3600 /* Expiration time, seconds */
#define ENV_MAX 4096 /* Size of environment block */
#define CGI_ENV_VARS 64 /* Maximum vars passed to CGI */
+#ifdef __rtems__
+#if defined(__SIZEOF_SIZE_T__) && (__SIZEOF_SIZE_T__ <= 2)
+/* HACK: Reduce the array size on targets with 16bit size_t */
+# if defined(__AVR__)
+/* FIXME: 1500 is sufficient to avoid compilation breakdown. */
+# define URI_MAX (32767-1500)
+# elif defined(__M32C__)
+/* FIXME: 1500 is sufficient to avoid compilation breakdown. */
+# define URI_MAX (32767-1500)
+# else
+/* Theoretically, this should work on all targets with 16bit size_t
+ * In practice, it trips over other compiler limitations. */
+# define URI_MAX 32767
+# endif
+#else // __SIZEOF_SIZE_T__ > 2
+/* HACK: 32768 is 1 too much to fit into 16bit array indices. */
+#define URI_MAX 32767 /* Maximum URI size */
+#endif
+#else // __rtems__
#define URI_MAX 32768 /* Maximum URI size */
+#endif
#define MIN_REQ_LEN 16 /* "GET / HTTP/1.1\n\n" */
#define NELEMS(ar) (sizeof(ar) / sizeof(ar[0]))