diff options
author | Kay Sievers <kay.sievers@suse.de> | 2006-09-05 00:50:25 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@suse.de> | 2006-09-05 00:50:25 +0200 |
commit | ac528431dd60c6b7f6b664ba430b937a11a32230 (patch) | |
tree | 1167bd54cd52e214858b5694d7d4244f3deef1d3 /udev_rules.c | |
parent | 64e0ce85de834bfd442228c18fe602d1d988064b (diff) |
fix ENV{TEST}="Test: $env{TEST}"
Diffstat (limited to 'udev_rules.c')
-rw-r--r-- | udev_rules.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/udev_rules.c b/udev_rules.c index 8a2066d709..1483f8f493 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -802,13 +802,19 @@ try_parent: struct key_pair *pair = &rule->env.keys[i]; if (pair->key.operation == KEY_OP_ASSIGN) { + char temp_value[NAME_SIZE]; const char *key_name = key_pair_name(rule, pair); const char *value = key_val(rule, &pair->key); - char *key_value = name_list_key_add(&udev->env_list, key_name, value); + char *key_value; + + /* make sure we don't write to the same string we possibly read from */ + strlcpy(temp_value, value, sizeof(temp_value)); + udev_rules_apply_format(udev, temp_value, NAME_SIZE); + + key_value = name_list_key_add(&udev->env_list, key_name, temp_value); if (key_value == NULL) break; - udev_rules_apply_format(udev, key_value, NAME_SIZE); putenv(key_value); dbg("export ENV '%s'", key_value); } |