trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sor...@apache.org
Subject trafficserver git commit: TS-3649: Check key length during config parse
Date Mon, 01 Jun 2015 21:24:00 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 133df337c -> 7cae89187


TS-3649: Check key length during config parse


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/7cae8918
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/7cae8918
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/7cae8918

Branch: refs/heads/master
Commit: 7cae891870a5634dd28f2a679ff3b4f9a9fbe82b
Parents: 133df33
Author: Phil Sorber <sorber@apache.org>
Authored: Thu May 28 16:35:30 2015 -0600
Committer: Phil Sorber <sorber@apache.org>
Committed: Mon Jun 1 15:23:05 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/7cae8918/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);


Mime
View raw message