diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-02-24 15:01:11 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-02-24 15:01:11 -0800 |
commit | 96bb428fb9d47b332f5c2e979af76e8c2ee75d0e (patch) | |
tree | 573ea1a6a4abaffcffd602e55dd9f60ddc5162f7 /match.c | |
parent | 09bec4f655754f06ecea62cd939339a793a60719 (diff) | |
download | txr-96bb428fb9d47b332f5c2e979af76e8c2ee75d0e.tar.gz txr-96bb428fb9d47b332f5c2e979af76e8c2ee75d0e.tar.bz2 txr-96bb428fb9d47b332f5c2e979af76e8c2ee75d0e.zip |
* match.c (v_load): Sanity checking on target path.
Check if it is absolute and do not substitute parent
file's directory.
Diffstat (limited to 'match.c')
-rw-r--r-- | match.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -3375,10 +3375,18 @@ static val v_load(match_files_ctx *c) if (rest(specline)) sem_error(specline, lit("unexpected material after load"), nao); + if (!stringp(target)) + sem_error(specline, lit("load: path ~s is not a string"), target, nao); + + if (equal(target, null_string)) + sem_error(specline, lit("load: null string path given"), nao); + { - val path = cat_str(nappend2(sub_list(split_str(parent, lit("/")), + val path = if3(chr_str(target, zero) == chr('/'), + target, + cat_str(nappend2(sub_list(split_str(parent, lit("/")), zero, negone), - cons(target, nil)), lit("/")); + cons(target, nil)), lit("/"))); int gc = gc_state(0); parse_reset(path); yyparse(); |