Sanitize error text to reduce TCL errors
This commit is contained in:
@ -402,6 +402,7 @@ static char *SctActionHandler(void *actionData, char *lastReply,
|
||||
char *errorScript = NULL;
|
||||
char *send = NULL;
|
||||
int i;
|
||||
int j;
|
||||
SConnection *con;
|
||||
char eprop[80];
|
||||
char msg[1024];
|
||||
@ -516,6 +517,21 @@ static char *SctActionHandler(void *actionData, char *lastReply,
|
||||
if (strcasecmp(data->name, "read") == 0) {
|
||||
SetHdbProperty(node, "geterror", result);
|
||||
}
|
||||
/* Sanitize the text to reduce TCL problems with unbalanced and substituted items */
|
||||
for (j = 0; msg[j]; ++j) {
|
||||
switch (msg[j]) {
|
||||
case '{':
|
||||
case '}':
|
||||
case '[':
|
||||
case ']':
|
||||
case '<':
|
||||
case '>':
|
||||
case '\'':
|
||||
case '"':
|
||||
case '$':
|
||||
msg[j] = '_';
|
||||
}
|
||||
}
|
||||
SetHdbProperty(node, eprop, msg);
|
||||
blank = strchr(origScript, ' ');
|
||||
if (blank != NULL) {
|
||||
@ -531,6 +547,21 @@ static char *SctActionHandler(void *actionData, char *lastReply,
|
||||
}
|
||||
cnt++;
|
||||
snprintf(msg, sizeof msg, "%dx {%s}: %s", cnt, origScript, result);
|
||||
/* Sanitize the text to reduce TCL problems with unbalanced and substituted items */
|
||||
for (j = 0; msg[j]; ++j) {
|
||||
switch (msg[j]) {
|
||||
case '{':
|
||||
case '}':
|
||||
case '[':
|
||||
case ']':
|
||||
case '<':
|
||||
case '>':
|
||||
case '\'':
|
||||
case '"':
|
||||
case '$':
|
||||
msg[j] = '_';
|
||||
}
|
||||
}
|
||||
SetHdbProperty(node, eprop, msg);
|
||||
send = NULL;
|
||||
free(script);
|
||||
|
Reference in New Issue
Block a user