alpine 3.6
obsolete weakness #283

1

Weakness Breakdown


Definition:

An obsolete weakness occurs when someone uses deprecated or obsolete functions when building a system. As a programming language evolves, some functions occasionally become obsolete.

Warning code(s):

This C routine is considered obsolete.

File Name:

lua-xctrl/src/xctrl-2015.04.10/src/xctrl.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.6 obsolete weakness.

 

XCTRL_API char *get_window_title(Display*disp, Window win)
{
  char *wm_name = get_prop(disp, win, GetUTF8Atom(), "_NET_WM_NAME", NULL);
  if (wm_name) {
    return wm_name;
  } else {
    char *title_utf8 = NULL;
    wm_name = get_prop(disp, win, XA_STRING, "WM_NAME", NULL);
    if (wm_name) {
      title_utf8 = locale_to_utf8(wm_name);
      free(wm_name);
    } else {
      title_utf8 = NULL;
    }
    return title_utf8;
  }
}



static void pass_click_to_client(Display*disp, Window root, XEvent*event, int mask, Cursor cursor)
{
  usleep(1000);
  XSync(disp,False);
  event->xbutton.window=event->xbutton.subwindow;
  XSendEvent(disp, event->xbutton.subwindow, True, mask, event);
  usleep(1000);
  XSync(disp,False);
}


#define GrabMouse() ( \
  XGrabPointer(disp,root,False,ButtonPressMask|ButtonReleaseMask, \
    GrabModeSync,GrabModeAsync,root,cursor,CurrentTime) == GrabSuccess )


/* Routine to let user select a window using the mouse adapted from xfree86. */
XCTRL_API Window select_window(Display*disp, int button)
{
  Cursor cursor;
  XEvent event;
  Window target_win = None;
  Window root = DefaultRootWindow(disp);
  int buttons = 0;
  int dumi;
  unsigned int dum;
  cursor = XCreateFontCursor(disp, XC_crosshair);
  if (!GrabMouse()) { 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.