Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit d39bcf9

Browse files
authored
Libinjection version 991433e7 (#524)
https://github.com/libinjection/libinjection commit 991433e7f0cd8db3ad24f1b0c429881d44251505
1 parent 1e19fcd commit d39bcf9

11 files changed

Lines changed: 879 additions & 485 deletions

File tree

naxsi_src/ext/libinjection/COPYING

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Copyright (c) 2012-2016, Nick Galbreath
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are
6+
met:
7+
8+
1. Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
11+
2. Redistributions in binary form must reproduce the above copyright
12+
notice, this list of conditions and the following disclaimer in the
13+
documentation and/or other materials provided with the distribution.
14+
15+
3. Neither the name of the copyright holder nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
31+
https://github.com/client9/libinjection
32+
http://opensource.org/licenses/BSD-3-Clause

naxsi_src/ext/libinjection/fptool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ int main(int argc, const char* argv[])
5050

5151
if (single) {
5252
libinjection_sqli_fingerprint(&sf, FLAG_QUOTE_NONE | FLAG_SQL_ANSI);
53-
ok = libinjection_sqli_check_fingerprint(&sf);
53+
libinjection_sqli_check_fingerprint(&sf);
5454
fprintf(stdout, "%s\n", sf.fingerprint);
5555
return 0;
5656
}

naxsi_src/ext/libinjection/libinjection.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/**
2-
* Copyright 2012, 2013 Nick Galbreath
2+
* Copyright 2012-2016 Nick Galbreath
33
* nickg@client9.com
44
* BSD License -- see COPYING.txt for details
55
*
66
* https://libinjection.client9.com/
77
*
88
*/
99

10-
#ifndef _LIBINJECTION_H
11-
#define _LIBINJECTION_H
10+
#ifndef LIBINJECTION_H
11+
#define LIBINJECTION_H
1212

1313
#ifdef __cplusplus
1414
# define LIBINJECTION_BEGIN_DECLS extern "C" {
@@ -47,19 +47,19 @@ const char* libinjection_version(void);
4747
* \param[out] fingerprint buffer of 8+ characters. c-string,
4848
* \return 1 if SQLi, 0 if benign. fingerprint will be set or set to empty string.
4949
*/
50-
int libinjection_sqli(const char* s, size_t slen, char fingerprint[]);
50+
int libinjection_sqli(const char* input, size_t slen, char fingerprint[]);
5151

52-
/** ALPHA version of xss detector.
52+
/** ALPHA version of xss detector.
5353
*
54-
* NOT DONE.
54+
* NOT DONE.
5555
*
5656
* \param[in] s input string, may contain nulls, does not need to be null-terminated
5757
* \param[in] slen input string length
5858
* \return 1 if XSS found, 0 if benign
5959
*
6060
*/
61-
int libinjection_xss(const char* s, size_t slen);
61+
int libinjection_xss(const char* s, size_t len);
6262

6363
LIBINJECTION_END_DECLS
6464

65-
#endif /* _LIBINJECTION_H */
65+
#endif /* LIBINJECTION_H */

naxsi_src/ext/libinjection/libinjection_html5.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
/* prototypes */
3030

3131
static int h5_skip_white(h5_state_t* hs);
32-
static int h5_is_white(char c);
32+
static int h5_is_white(char ch);
3333
static int h5_state_eof(h5_state_t* hs);
3434
static int h5_state_data(h5_state_t* hs);
3535
static int h5_state_tag_open(h5_state_t* hs);
@@ -106,9 +106,9 @@ int libinjection_h5_next(h5_state_t* hs)
106106
static int h5_is_white(char ch)
107107
{
108108
/*
109-
* \t = htab = 0x09
109+
* \t = horizontal tab = 0x09
110110
* \n = newline = 0x0A
111-
* \v = vtab = 0x0B
111+
* \v = vertical tab = 0x0B
112112
* \f = form feed = 0x0C
113113
* \r = cr = 0x0D
114114
*/
@@ -180,6 +180,9 @@ static int h5_state_tag_open(h5_state_t* hs)
180180
char ch;
181181

182182
TRACE();
183+
if (hs->pos >= hs->len) {
184+
return 0;
185+
}
183186
ch = hs->s[hs->pos];
184187
if (ch == CHAR_BANG) {
185188
hs->pos += 1;
@@ -458,7 +461,7 @@ static int h5_state_attribute_value_quote(h5_state_t* hs, char qchar)
458461
TRACE();
459462

460463
/* skip initial quote in normal case.
461-
* dont do this is pos == 0 since it means we have started
464+
* don't do this "if (pos == 0)" since it means we have started
462465
* in a non-data state. given an input of '><foo
463466
* we want to make 0-length attribute name
464467
*/

0 commit comments

Comments
 (0)