jordansissel / xdotool

fake keyboard/mouse input, window management, and more
Other
3.28k stars 321 forks source link

fix potential null deref reported by static analyzer #460

Open danix800 opened 6 months ago

danix800 commented 6 months ago

Calling 'xdo_translate_window_with_sizehint' from 'xdo_set_window_size' shows both 'width_ret' and 'height_ret' could be null. Storing values into these pointers could be a null deref.

If these two pointers couldn't be null, then the condition in the following

  if (width_ret != NULL) {
    *width_ret = width;
  }

  if (height_ret != NULL) {
    *height_ret = height;
  }

is redundant, this is a reversed null checking.