aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjcid <devnull@localhost>2008-08-25 23:42:08 +0200
committerjcid <devnull@localhost>2008-08-25 23:42:08 +0200
commit7048063efcc630376103dcf7d3fe046abc0ef1c1 (patch)
tree975f5f3015859b02f34a5c4fb129dc246e14ff03
parentb3360fe4dc669e0b6bdbe6ae1d66320f13f880f9 (diff)
- Added rows/cols value checks for TEXTAREA element.
-rw-r--r--src/form.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/form.cc b/src/form.cc
index 7841434b..39380ac2 100644
--- a/src/form.cc
+++ b/src/form.cc
@@ -616,6 +616,8 @@ void Html_tag_open_isindex(DilloHtml *html, const char *tag, int tagsize)
*/
void Html_tag_open_textarea(DilloHtml *html, const char *tag, int tagsize)
{
+ const int MAX_COLS=1024, MAX_ROWS=10000;
+
char *name;
const char *attrbuf;
int cols, rows;
@@ -637,9 +639,19 @@ void Html_tag_open_textarea(DilloHtml *html, const char *tag, int tagsize)
cols = 20;
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "cols")))
cols = strtol(attrbuf, NULL, 10);
+ if (cols < 1 || cols > MAX_COLS) {
+ int badCols = cols;
+ cols = (cols < 1 ? 20 : MAX_COLS);
+ BUG_MSG("textarea cols=%d, using cols=%d instead\n", badCols, cols);
+ }
rows = 10;
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "rows")))
rows = strtol(attrbuf, NULL, 10);
+ if (rows < 1 || rows > MAX_ROWS) {
+ int badRows = rows;
+ rows = (rows < 1 ? 2 : MAX_ROWS);
+ BUG_MSG("textarea rows=%d, using rows=%d instead\n", badRows, rows);
+ }
name = NULL;
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "name")))
name = dStrdup(attrbuf);