Use safe wrappers wherever possible
This commit is contained in:
@ -220,21 +220,21 @@ static int stdin_string(void *context, const unsigned char *val, size_t len) {
|
||||
return 1;
|
||||
}
|
||||
if (strcasecmp(ctx->last_map_key, "min_width") == 0) {
|
||||
char *copy = (char *)malloc(len + 1);
|
||||
char *copy = (char *)smalloc(len + 1);
|
||||
strncpy(copy, (const char *)val, len);
|
||||
copy[len] = 0;
|
||||
ctx->block.min_width_str = copy;
|
||||
return 1;
|
||||
}
|
||||
if (strcasecmp(ctx->last_map_key, "name") == 0) {
|
||||
char *copy = (char *)malloc(len + 1);
|
||||
char *copy = (char *)smalloc(len + 1);
|
||||
strncpy(copy, (const char *)val, len);
|
||||
copy[len] = 0;
|
||||
ctx->block.name = copy;
|
||||
return 1;
|
||||
}
|
||||
if (strcasecmp(ctx->last_map_key, "instance") == 0) {
|
||||
char *copy = (char *)malloc(len + 1);
|
||||
char *copy = (char *)smalloc(len + 1);
|
||||
strncpy(copy, (const char *)val, len);
|
||||
copy[len] = 0;
|
||||
ctx->block.instance = copy;
|
||||
|
@ -1654,8 +1654,7 @@ void reconfig_windows(bool redraw_bars) {
|
||||
"i3bar\0i3bar\0");
|
||||
|
||||
char *name;
|
||||
if (asprintf(&name, "i3bar for output %s", walk->name) == -1)
|
||||
err(EXIT_FAILURE, "asprintf()");
|
||||
sasprintf(&name, "i3bar for output %s", walk->name);
|
||||
xcb_void_cookie_t name_cookie;
|
||||
name_cookie = xcb_change_property(xcb_connection,
|
||||
XCB_PROP_MODE_REPLACE,
|
||||
|
Reference in New Issue
Block a user