Skip to content

Type Error Risk in pwnlib.term.readline: rstrip(b'\n') Called on String #2584

Open
@chenyangyc

Description

@chenyangyc

Description

File & line: pwnlib/term/readline.py:382.

if not term_mode:
  print(prompt, end='', flush=True)
  return getattr(sys.stdin, 'buffer', sys.stdin).readline(_size).rstrip(b'\n')

pwnlib.term.readline calls rstrip(b'\n') on the result of sys.stdin.readline(...).

Because rstrip() is defined for str and its overloads only accept str | None, passing a bytes literal (b'\n') may trigger a type error :

Versions:

  • pwntools :4.12.0
  • python: 3.9.13
  • system: Ubuntu 22.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions