From eec7101174a3b2807fb282272f75cc13d4b953c3 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 25 May 2012 15:18:43 +0300 Subject: Additional changes / some cleanups. --- gawkapi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gawkapi.c') diff --git a/gawkapi.c b/gawkapi.c index dbaa730e..a25a8905 100644 --- a/gawkapi.c +++ b/gawkapi.c @@ -255,13 +255,17 @@ node_to_awk_value(NODE *node, awk_value_t *val) /* * Lookup a variable, return its value. No messing with the value * returned. Return value is NULL if the variable doesn't exist. + * Built-in variables (except PROCINFO) may not be changed by an extension. */ static awk_value_t * api_sym_lookup(awk_ext_id_t id, const char *name, awk_value_t *result) { NODE *node; - if (name == NULL || (node = lookup(name)) == NULL) + if ( name == NULL + || *name == '\0' + || is_off_limits_var(name) /* most built-in vars not allowed */ + || (node = lookup(name)) == NULL) return NULL; return node_to_awk_value(node, result); -- cgit v1.2.3