Skip to content

Commit bb11c24

Browse files
committed
check that cookies data is valid string 8 to follow assertions.
1 parent d158579 commit bb11c24

File tree

1 file changed

+30
-28
lines changed

1 file changed

+30
-28
lines changed

library/server/wsf/src/wsf_request.e

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,41 +1262,43 @@ feature {NONE} -- Cookies
12621262
local
12631263
i,j,p,n: INTEGER
12641264
l_cookies: like internal_cookies_table
1265+
s32: READABLE_STRING_32
12651266
k,v,s: STRING
12661267
do
12671268
l_cookies := internal_cookies_table
12681269
if l_cookies = Void then
1270+
create l_cookies.make_equal (0)
12691271
if attached {WSF_STRING} meta_variable ({WSF_META_NAMES}.http_cookie) as val then
1270-
s := val.value
1271-
create l_cookies.make_equal (5)
1272-
from
1273-
n := s.count
1274-
p := 1
1275-
i := 1
1276-
until
1277-
p < 1
1278-
loop
1279-
i := s.index_of ('=', p)
1280-
if i > 0 then
1281-
j := s.index_of (';', i)
1282-
if j = 0 then
1283-
j := n + 1
1284-
k := s.substring (p, i - 1)
1285-
v := s.substring (i + 1, n)
1286-
1287-
p := 0 -- force termination
1288-
else
1289-
k := s.substring (p, i - 1)
1290-
v := s.substring (i + 1, j - 1)
1291-
p := j + 1
1272+
s32 := val.value
1273+
if s32.is_valid_as_string_8 then
1274+
s := s32.to_string_8
1275+
from
1276+
n := s.count
1277+
p := 1
1278+
i := 1
1279+
until
1280+
p < 1
1281+
loop
1282+
i := s.index_of ('=', p)
1283+
if i > 0 then
1284+
j := s.index_of (';', i)
1285+
if j = 0 then
1286+
j := n + 1
1287+
k := s.substring (p, i - 1)
1288+
v := s.substring (i + 1, n)
1289+
1290+
p := 0 -- force termination
1291+
else
1292+
k := s.substring (p, i - 1)
1293+
v := s.substring (i + 1, j - 1)
1294+
p := j + 1
1295+
end
1296+
k.left_adjust
1297+
k.right_adjust
1298+
add_value_to_table (k, v, l_cookies)
12921299
end
1293-
k.left_adjust
1294-
k.right_adjust
1295-
add_value_to_table (k, v, l_cookies)
12961300
end
12971301
end
1298-
else
1299-
create l_cookies.make_equal (0)
13001302
end
13011303
internal_cookies_table := l_cookies
13021304
end
@@ -2065,7 +2067,7 @@ invariant
20652067
wgi_request.content_type /= Void implies content_type /= Void
20662068

20672069
note
2068-
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
2070+
copyright: "2011-2014, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
20692071
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
20702072
source: "[
20712073
Eiffel Software

0 commit comments

Comments
 (0)