Alexandre Julliard : winebuild: Check for illegal characters in entry point names.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Dec 4 07:17:01 CST 2006


Module: wine
Branch: master
Commit: 813ae10f33949ea3f2bc259e68ecd8131346f671
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=813ae10f33949ea3f2bc259e68ecd8131346f671

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Dec  4 12:23:58 2006 +0100

winebuild: Check for illegal characters in entry point names.

---

 tools/winebuild/parser.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c
index 78b5d80..3e0c400 100644
--- a/tools/winebuild/parser.c
+++ b/tools/winebuild/parser.c
@@ -46,6 +46,9 @@ static FILE *input_file;
 static const char *separator_chars;
 static const char *comment_chars;
 
+/* valid characters in ordinal names */
+static const char valid_ordname_chars[] = "/$:-_@?abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+
 static const char * const TypeNames[TYPE_NBTYPES] =
 {
     "variable",     /* TYPE_VARIABLE */
@@ -447,6 +450,7 @@ static const char *parse_spec_flags( ORD
 static int parse_spec_ordinal( int ordinal, DLLSPEC *spec )
 {
     const char *token;
+    size_t len;
 
     ORDDEF *odp = add_entry_point( spec );
     memset( odp, 0, sizeof(*odp) );
@@ -470,6 +474,13 @@ static int parse_spec_ordinal( int ordin
     odp->lineno = current_line;
     odp->ordinal = ordinal;
 
+    len = strspn( odp->name, valid_ordname_chars );
+    if (len < strlen( odp->name ))
+    {
+        error( "Character '%c' is not allowed in exported name '%s'\n", odp->name[len], odp->name );
+        goto error;
+    }
+
     switch(odp->type)
     {
     case TYPE_VARIABLE:




More information about the wine-cvs mailing list