berns 3.2.1 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +15 -16
- data/ext/berns/berns.c +15 -8
- data/lib/berns/berns.so +0 -0
- data/lib/berns/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e477eaf0fc69e3218e9bd93d0ece7a2635b42157dfa4dac49f44134822f5347e
|
4
|
+
data.tar.gz: d536572a3ecfb3fb84eac0a5624fb2fb662079de615c0afd431dffe940c064f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43620249a6d836dca7da50946bf63835b5d21cadcd2fc0de543be5adb11ac4d0f97ee086f139cb49ed600d09b93ba262414f2f7d9113cabd6b50a85a597ea619
|
7
|
+
data.tar.gz: 6354871cfe7c0e1558de95f0c5230d3e9edeeed778868496192da8583b747411d08bd16826faa2d53c67e65f0c6216c1c48a751e4abb17d74623351c6c33ead4
|
data/LICENSE.txt
CHANGED
@@ -1,21 +1,20 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright
|
3
|
+
Copyright © 2021 Taylor Beck and Evan Lecklider
|
4
4
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the “Software”), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
11
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
14
|
|
15
|
-
THE SOFTWARE IS PROVIDED
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
THE SOFTWARE.
|
15
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/ext/berns/berns.c
CHANGED
@@ -110,17 +110,24 @@ static VALUE external_sanitize(RB_UNUSED_VAR(VALUE self), VALUE string) {
|
|
110
110
|
char *str = RSTRING_PTR(string);
|
111
111
|
|
112
112
|
char dest[slen + 1];
|
113
|
-
|
114
|
-
int
|
115
|
-
int
|
113
|
+
|
114
|
+
unsigned int index = 0;
|
115
|
+
unsigned int open = 0;
|
116
|
+
unsigned int modified = 0;
|
117
|
+
unsigned int entity = 0;
|
116
118
|
|
117
119
|
for (unsigned int i = 0; i < slen; i++) {
|
118
120
|
if (str[i] == '<') {
|
119
121
|
open = 1;
|
120
|
-
|
122
|
+
modified = 1;
|
121
123
|
} else if (str[i] == '>') {
|
122
124
|
open = 0;
|
123
|
-
} else if (
|
125
|
+
} else if (str[i] == '&') {
|
126
|
+
entity = 1;
|
127
|
+
modified = 1;
|
128
|
+
} else if (str[i] == ';') {
|
129
|
+
entity = 0;
|
130
|
+
} else if (!open && !entity) {
|
124
131
|
dest[index++] = str[i];
|
125
132
|
}
|
126
133
|
}
|
@@ -128,10 +135,10 @@ static VALUE external_sanitize(RB_UNUSED_VAR(VALUE self), VALUE string) {
|
|
128
135
|
dest[index] = '\0';
|
129
136
|
|
130
137
|
/*
|
131
|
-
* If
|
132
|
-
* string from our destination buffer.
|
138
|
+
* If the string was never modified, return the original string, otherwise
|
139
|
+
* create a new string from our destination buffer.
|
133
140
|
*/
|
134
|
-
if (
|
141
|
+
if (modified) {
|
135
142
|
return rb_utf8_str_new_cstr(dest);
|
136
143
|
} else {
|
137
144
|
return string;
|
data/lib/berns/berns.so
CHANGED
Binary file
|
data/lib/berns/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: berns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taylor Beck
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: benchmark-ips
|