Enlightenment CVS committal
Author : tsauerbeck
Project : e17
Module : libs/edje
Dir : e17/libs/edje/src/bin
Modified Files:
edje_cc.c edje_decc.c
Log Message:
Decompiler improvements: Edjes now contain a 'compiler' entry, which is set to
the executable that's used to compile an Edje. edje_decc does some sanity
checking on this string, to prevent exploitation.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_cc.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- edje_cc.c 16 Mar 2005 17:51:52 -0000 1.23
+++ edje_cc.c 16 Mar 2005 18:39:38 -0000 1.24
@@ -193,6 +193,7 @@
edje_init();
edje_file = mem_alloc(SZ(Edje_File));
+ edje_file->compiler = strdup("edje_cc");
edje_file->version = EDJE_FILE_VERSION;
edje_file->feature_ver = 1; /* increment this every time we add a field
* or feature to the edje file format that
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_decc.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- edje_decc.c 16 Mar 2005 17:51:52 -0000 1.8
+++ edje_decc.c 16 Mar 2005 18:39:38 -0000 1.9
@@ -23,6 +23,7 @@
int e_file_is_dir(char *file);
int e_file_mkdir(char *dir);
int e_file_mkpath(char *path);
+static int compiler_cmd_is_sane();
static void
main_help(void)
@@ -90,6 +91,16 @@
eet_close(ef);
return 0;
}
+ if (!edje_file->compiler)
+ {
+ edje_file->compiler = strdup("edje_cc");
+ }
+ else if (!compiler_cmd_is_sane())
+ {
+ printf("ERROR: invalid compiler executable: '%s'\n",
edje_file->compiler);
+ eet_close(ef);
+ return 0;
+ }
fontlist = source_fontmap_load(ef);
eet_close(ef);
return 1;
@@ -263,7 +274,7 @@
}
f = fopen(out, "w");
fprintf(f, "#!/bin/sh\n");
- fprintf(f, "edje_cc $@ -id . -fd . main_edje_source.edc -o %s.eet\n",
outdir);
+ fprintf(f, "%s $@ -id . -fd . main_edje_source.edc -o %s.eet\n",
edje_file->compiler, outdir);
fclose(f);
#ifndef WIN32
@@ -321,3 +332,25 @@
else if (!e_file_is_dir(ss)) return 0;
return 1;
}
+
+static int
+compiler_cmd_is_sane()
+{
+ char *c = edje_file->compiler, *ptr;
+
+ if (!c || !*c)
+ {
+ return 0;
+ }
+
+ for (ptr = c; ptr && *ptr; ptr++)
+ {
+ /* only allow [a-z][A-Z][0-9]_- */
+ if (!isalnum(*ptr) && *ptr != '_' && *ptr != '-')
+ {
+ return 0;
+ }
+ }
+
+ return 1;
+}
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs