Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
60ad75ea
Commit
60ad75ea
authored
Feb 25, 2009
by
James Hawkins
Committed by
Alexandre Julliard
Feb 26, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Make sure a constant string's quotes match up.
parent
a67d80b4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
13 deletions
+23
-13
sql.y
dlls/msi/sql.y
+19
-12
db.c
dlls/msi/tests/db.c
+4
-1
No files found.
dlls/msi/sql.y
View file @
60ad75ea
...
...
@@ -49,7 +49,7 @@ typedef struct tag_SQL_input
struct list *mem;
} SQL_input;
static
LPWSTR SQL_getstring( void *info, const struct sql_str
*str );
static
UINT SQL_getstring( void *info, const struct sql_str *strdata, LPWSTR
*str );
static INT SQL_getint( void *info );
static int sql_lex( void *SQL_lval, SQL_input *info );
...
...
@@ -677,8 +677,7 @@ table:
id:
TK_ID
{
$$ = SQL_getstring( info, &$1 );
if( !$$ )
if ( SQL_getstring( info, &$1, &$$ ) != ERROR_SUCCESS || !$$ )
YYABORT;
}
;
...
...
@@ -757,11 +756,15 @@ static int sql_lex( void *SQL_lval, SQL_input *sql )
return token;
}
LPWSTR SQL_getstring( void *info, const struct sql_str *strdata
)
UINT SQL_getstring( void *info, const struct sql_str *strdata, LPWSTR *str
)
{
LPCWSTR p = strdata->data;
UINT len = strdata->len;
LPWSTR str;
/* match quotes */
if( ( (p[0]=='`') && (p[len-1]!='`') ) ||
( (p[0]=='\'') && (p[len-1]!='\'') ) )
return ERROR_FUNCTION_FAILED;
/* if there's quotes, remove them */
if( ( (p[0]=='`') && (p[len-1]=='`') ) ||
...
...
@@ -770,13 +773,13 @@ LPWSTR SQL_getstring( void *info, const struct sql_str *strdata )
p++;
len -= 2;
}
str = parser_alloc( info, (len + 1)*sizeof(WCHAR) );
if( !str )
return
str
;
memcpy( str, p, len*sizeof(WCHAR) );
str
[len]=0;
*
str = parser_alloc( info, (len + 1)*sizeof(WCHAR) );
if( !
*
str )
return
ERROR_OUTOFMEMORY
;
memcpy(
*
str, p, len*sizeof(WCHAR) );
(*str)
[len]=0;
return
str
;
return
ERROR_SUCCESS
;
}
INT SQL_getint( void *info )
...
...
@@ -867,7 +870,11 @@ static struct expr * EXPR_sval( void *info, const struct sql_str *str )
if( e )
{
e->type = EXPR_SVAL;
e->u.sval = SQL_getstring( info, str );
if( SQL_getstring( info, str, (LPWSTR *)&e->u.sval ) != ERROR_SUCCESS )
{
msi_free( e );
return NULL;
}
}
return e;
}
...
...
dlls/msi/tests/db.c
View file @
60ad75ea
...
...
@@ -651,7 +651,10 @@ static void test_msibadqueries(void)
ok
(
r
==
ERROR_SUCCESS
,
"query failed
\n
"
);
r
=
try_query
(
hdb
,
"select * from c where b = 'x"
);
todo_wine
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"query failed
\n
"
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"query failed
\n
"
);
r
=
try_query
(
hdb
,
"select * from c where b = 'x'"
);
ok
(
r
==
ERROR_SUCCESS
,
"query failed
\n
"
);
r
=
try_query
(
hdb
,
"select * from 'c'"
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"query failed
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment