Skip to content

Commit 2f0ff4f

Browse files
dvorak42sipma
authored andcommitted
Support more sprintf format strings for patching.
1 parent ca408ce commit 2f0ff4f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

chb/buffer/LibraryCallCallsites.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,8 @@ def known_input_length(self) -> Optional[str]:
358358
fmtarg = self.instr.call_arguments[1]
359359
if fmtarg.is_string_reference:
360360
fmtstr = (cast(XprConstant, fmtarg)).constant.string_reference()
361-
if not "%s" in fmtstr:
361+
# TODO: Smarter heuristics for problematic length fmt strings
362+
if not "%" in fmtstr:
362363
return "sprintf:max_length_fmt"
363364
else:
364365
return None
@@ -368,7 +369,8 @@ def known_input_length(self) -> Optional[str]:
368369
fmtarg = self.instr.call_arguments[2]
369370
if fmtarg.is_string_reference:
370371
fmtstr = (cast(XprConstant, fmtarg)).constant.string_reference()
371-
if not "%s" in fmtstr:
372+
# TODO: Smarter heuristics for problematic length fmt strings
373+
if not "%" in fmtstr:
372374
return "snprintf:max_length_fmt"
373375
else:
374376
return None

0 commit comments

Comments
 (0)