Bug 708788 - xwininfo -name finds empty-named window
Summary: xwininfo -name finds empty-named window
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: xorg-x11-utils
Version: 15
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: X/OpenGL Maintenance List
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-05-29 15:12 UTC by Nadav Har'El
Modified: 2018-04-11 13:04 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-30 12:06:41 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
FreeDesktop.org 37710 0 None None None Never

Description Nadav Har'El 2011-05-29 15:12:10 UTC
Description of problem:
This is a new bug in xwininfo, created when this utility was translated from Xlib to XCB. "xwininfo -name ..." is supposed to find a window with the given name, but it can also find any window with an empty name.

The bug is in dsimple.c. All three calls to strncmp in that file should *not* use strlen(prop_name), but rather strlen(name). Otherwise, when any random window has an empty name, 0 characters are compared between this empty string and the looked-up name, and of course a match is found :-)

I also sent this bug upstream: https://bugs.freedesktop.org/show_bug.cgi?id=37710.

Version-Release number of selected component (if applicable):
Tested on xorg-x11-utils-7.5-2.fc15.x86_64

How reproducible:


Steps to Reproduce:
1. run Firefox              # this creates a window with an empty name)
2. xwininfo -name XYZ       # there isn't supposed to be a window with this name
  
Actual results:
xwininfo: Window id: 0x2a0006d (has no name)

  Absolute upper-left X:  0
  Absolute upper-left Y:  0
  Relative upper-left X:  0
  Relative upper-left Y:  0
  Width: 200
  Height: 200
...

Expected results:
xwininfo: error: No window with name "XYZ" exists!


Additional info:

Comment 1 Nadav Har'El 2011-05-29 15:20:46 UTC
Correction - switching to strlen(name) isn't accurate either.
I proposed a more accurate fix on the upstream bugzilla (see link above).

Comment 2 Matěj Cepl 2011-05-30 12:06:41 UTC
I believe that it is more appropriate to let this bug be resolved upstream.

We will continue to track the issue in the centralized upstream bug tracker, and will review any bug fixes that become available for consideration in future updates.

Thank you for helping to make free software better.


Note You need to log in before you can comment on or make changes to this bug.