Skip to content

[BUG] Buffer overflow in rofi -e - #2081

@faulesocke

Description

@faulesocke

Rofi version (rofi -v)

1.7.7

Configuration

na

Theme

na

Timing report

No response

Launch command

rofi -e -

Step to reproduce

  1. Launch rofi -e -
  2. Pipe some text to stdin. Works best with > 30 chars.
  3. Observe output on screen

Expected behavior

Only the piped-in text should be shown

Actual behavior

Sometimes extra garbage is added to the end of the text

Additional information

This happens in https://github.com/davatorium/rofi/blob/next/source/rofi.c#L820

After the while loop, there should be a

msg[index] = 0;

Sidenote: The code is also suboptimal, since even when only one read() ever returns data, it reallocates the buffer at least once.

But the code is simple and this does not really matter.

Using wayland display server protocol

  • No, I don't use the wayland display server protocol

I've checked if the issue exists in the latest stable release

  • Yes, I have checked the problem exists in the latest stable version

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions