forked from external/yambar
xcb: use strncpy() to extract atom name
This commit is contained in:
parent
04f7f3485f
commit
7bb849bdf4
1 changed files with 2 additions and 4 deletions
6
xcb.c
6
xcb.c
|
@ -191,10 +191,8 @@ get_atom_name(xcb_connection_t *conn, xcb_atom_t atom)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int len = xcb_get_atom_name_name_length(reply);
|
||||
char *name = malloc(len + 1);
|
||||
memcpy(name, xcb_get_atom_name_name(reply), len);
|
||||
name[len] = '\0';
|
||||
char *name = strndup(
|
||||
xcb_get_atom_name_name(reply), xcb_get_atom_name_name_length(reply));
|
||||
|
||||
LOG_DBG("atom name: %s", name);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue