You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2015/06/02 06:08:29 UTC
[9/9] trafficserver git commit: TS-3649: Check key length during
config parse
TS-3649: Check key length during config parse
(cherry picked from commit 7cae891870a5634dd28f2a679ff3b4f9a9fbe82b)
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/62be1813
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/62be1813
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/62be1813
Branch: refs/heads/5.3.x
Commit: 62be18134f670c0fc1884ded025e8314faf3bccb
Parents: b8ca261
Author: Phil Sorber <so...@apache.org>
Authored: Thu May 28 16:35:30 2015 -0600
Committer: Phil Sorber <so...@apache.org>
Committed: Mon Jun 1 22:02:00 2015 -0600
----------------------------------------------------------------------
plugins/experimental/url_sig/url_sig.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/62be1813/plugins/experimental/url_sig/url_sig.c
----------------------------------------------------------------------
diff --git a/plugins/experimental/url_sig/url_sig.c b/plugins/experimental/url_sig/url_sig.c
index 9ca273c..43fdef0 100644
--- a/plugins/experimental/url_sig/url_sig.c
+++ b/plugins/experimental/url_sig/url_sig.c
@@ -91,7 +91,7 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char *errbuf, int errbuf_s
return TS_ERROR;
}
- char line[260];
+ char line[300];
int line_no = 0;
int keynum;
@@ -115,8 +115,10 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char *errbuf, int errbuf_s
pos = strchr(value, '\n'); // remove the new line, terminate the string
if (pos != NULL) {
*pos = '\0';
- } else {
- snprintf(errbuf, errbuf_size - 1, "[TSRemapNewInstance] - Maximum line (%d) exceeded on line %d.", MAX_KEY_LEN, line_no);
+ }
+ if (pos == NULL || strlen(value) >= MAX_KEY_LEN) {
+ snprintf(errbuf, errbuf_size - 1, "[TSRemapNewInstance] - Maximum key length (%d) exceeded on line %d.", MAX_KEY_LEN - 1,
+ line_no);
fclose(file);
free_cfg(cfg);
return TS_ERROR;
@@ -139,7 +141,7 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char *errbuf, int errbuf_s
free_cfg(cfg);
return TS_ERROR;
}
- strcpy(&cfg->keys[keynum][0], value);
+ strncpy(&cfg->keys[keynum][0], value, MAX_KEY_LEN - 1);
} else if (strncmp(line, "error_url", 9) == 0) {
if (atoi(value)) {
cfg->err_status = atoi(value);