Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
faulesocke opened this issue Jan 16, 2025 · 2 comments
Closed
2 tasks done

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

faulesocke opened this issue Jan 16, 2025 · 2 comments
Labels
Milestone

Comments

@faulesocke
Copy link
Contributor

faulesocke commented Jan 16, 2025

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
@faulesocke
Copy link
Contributor Author

For reproducing this in the shell, do something like:

echo -n "foobar bluuuu blaaa blubb blaaah" | rofi -e -

@DaveDavenport
Copy link
Collaborator

Merged fix, thanks.

@DaveDavenport DaveDavenport added this to the 1.7.8 milestone Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants