Skip to content

Commit

Permalink
Change ONEOF to output a valid expression (for 500 fixing algo)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marven11 committed Oct 27, 2023
1 parent 3458c93 commit e54b1c6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fenjing/payload_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1205,12 +1205,12 @@ def gen_string_twostringconcat(context: dict, value: str):
if len(value) <= 2 or len(value) > 20:
return [(UNSATISFIED,)]
return [
(LITERAL, "'"), # test quotes first
# (LITERAL, "'"), # ONEOF should output a valid expression
(
ONEOF,
*[
[
(LITERAL, "{}'".format(value[:i].replace("'", "\\'"))),
(LITERAL, "'{}'".format(value[:i].replace("'", "\\'"))),
(LITERAL, "'{}'".format(value[i:].replace("'", "\\'"))),
]
for i in range(1, len(value) - 1)
Expand All @@ -1224,12 +1224,12 @@ def gen_string_twostringconcat2(context: dict, value: str):
if len(value) <= 2 or len(value) > 20:
return [(UNSATISFIED,)]
return [
(LITERAL, '"'), # test quotes first
(LITERAL, '"'), # ONEOF should output a valid expression
(
ONEOF,
*[
[
(LITERAL, '{}"'.format(value[:i].replace('"', '\\"'))),
(LITERAL, '"{}"'.format(value[:i].replace('"', '\\"'))),
(LITERAL, '"{}"'.format(value[i:].replace('"', '\\"'))),
]
for i in range(1, len(value) - 1)
Expand Down

0 comments on commit e54b1c6

Please sign in to comment.