You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2016/12/22 04:39:27 UTC
[trafficserver] branch master updated: TS-5097 Validate plugin
argument count
This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 077e980 TS-5097 Validate plugin argument count
077e980 is described below
commit 077e980ef7ac6539fd0445cf52605be160ac20b9
Author: Daniel Xu <dl...@yahoo.com>
AuthorDate: Fri Dec 16 13:18:09 2016 -0600
TS-5097 Validate plugin argument count
If we don't validate the plugin argument count, the plugin API is
vulnerable to buffer overflow fun (not actually fun).
---
proxy/Plugin.cc | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/proxy/Plugin.cc b/proxy/Plugin.cc
index 7d6e41d..b14e6ae 100644
--- a/proxy/Plugin.cc
+++ b/proxy/Plugin.cc
@@ -32,6 +32,8 @@
#include "Plugin.h"
#include "ts/ink_cap.h"
+#define MAX_PLUGIN_ARGS 64
+
static const char *plugin_dir = ".";
typedef void (*init_func_t)(int argc, char *argv[]);
@@ -219,8 +221,8 @@ plugin_init(bool validateOnly)
{
ats_scoped_str path;
char line[1024], *p;
- char *argv[64];
- char *vars[64];
+ char *argv[MAX_PLUGIN_ARGS];
+ char *vars[MAX_PLUGIN_ARGS];
int argc;
int fd;
int i;
@@ -255,6 +257,11 @@ plugin_init(bool validateOnly)
// not comment or blank, so rip line into tokens
while (1) {
+ if (argc >= MAX_PLUGIN_ARGS) {
+ Warning("Exceeded max number of args (%d) for plugin: [%s]", MAX_PLUGIN_ARGS, argc > 0 ? argv[0] : "???");
+ break;
+ }
+
while (*p && ParseRules::is_wslfcr(*p)) {
++p;
}
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].