Skip to content

Commit

Permalink
now we use "signed char" explicitly instead of the vague "char" type.
Browse files Browse the repository at this point in the history
  • Loading branch information
agentzh committed Nov 24, 2011
1 parent 767e94f commit 4349b2a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/ngx_http_xss_filter_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ ngx_http_xss_header_filter(ngx_http_request_t *r)
callback.data = p;
callback.len = dst - p;

if (ngx_http_xss_test_callback((char *) callback.data, callback.len)
if (ngx_http_xss_test_callback(callback.data, callback.len)
!= NGX_OK)
{
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
Expand Down
18 changes: 10 additions & 8 deletions src/ngx_http_xss_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,21 @@ static const int javascript_en_main = 1;

#line 8 "src/ngx_http_xss_util.rl"

ngx_int_t ngx_http_xss_test_callback(char *data, size_t len)
ngx_int_t ngx_http_xss_test_callback(u_char *data, size_t len)
{
char *p = data;
char *pe = data + len;
signed char *p = (signed char *) data;
signed char *pe;
int cs;

pe = p + len;


#line 29 "src/ngx_http_xss_util.c"
#line 31 "src/ngx_http_xss_util.c"
{
cs = javascript_start;
}

#line 34 "src/ngx_http_xss_util.c"
#line 36 "src/ngx_http_xss_util.c"
{
if ( p == pe )
goto _test_eof;
Expand Down Expand Up @@ -126,13 +128,13 @@ case 5:
_out: {}
}

#line 27 "src/ngx_http_xss_util.rl"
#line 29 "src/ngx_http_xss_util.rl"


if (cs <
#line 134 "src/ngx_http_xss_util.c"
#line 136 "src/ngx_http_xss_util.c"
6
#line 29 "src/ngx_http_xss_util.rl"
#line 31 "src/ngx_http_xss_util.rl"
|| p != pe) {
return NGX_DECLINED;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ngx_http_xss_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#endif


ngx_int_t ngx_http_xss_test_callback(char *data, size_t len);
ngx_int_t ngx_http_xss_test_callback(u_char *data, size_t len);


#endif /* NGX_HTTP_XSS_UTIL_H */
Expand Down
8 changes: 5 additions & 3 deletions src/ngx_http_xss_util.rl
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
%% machine javascript;
%% write data;

ngx_int_t ngx_http_xss_test_callback(char *data, size_t len)
ngx_int_t ngx_http_xss_test_callback(u_char *data, size_t len)
{
char *p = data;
char *pe = data + len;
signed char *p = (signed char *) data;
signed char *pe;
int cs;

pe = p + len;

%%{
identifier = [$A-Za-z_] [$A-Za-z0-9_]*;

Expand Down
2 changes: 1 addition & 1 deletion util/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ version=$1
force=$2

ngx-build $force $version \
--with-cc-opt="-O3" \
--with-cc-opt="-O3 -funsigned-char" \
--without-mail_pop3_module \
--without-mail_imap_module \
--without-mail_smtp_module \
Expand Down

0 comments on commit 4349b2a

Please sign in to comment.