Use sasprintf() instead of alloc'ing and strncpy() in i3bar.

resolves #1995
This commit is contained in:
Ingo Bürk
2015-10-17 22:14:48 +02:00
parent 22b05f0073
commit 0750b450b2
5 changed files with 17 additions and 52 deletions

View File

@ -30,10 +30,7 @@ static bool parsing_bindings;
*/
static int config_map_key_cb(void *params_, const unsigned char *keyVal, size_t keyLen) {
FREE(cur_key);
cur_key = smalloc(sizeof(unsigned char) * (keyLen + 1));
strncpy(cur_key, (const char *)keyVal, keyLen);
cur_key[keyLen] = '\0';
sasprintf(&(cur_key), "%.*s", keyLen, keyVal);
if (strcmp(cur_key, "bindings") == 0)
parsing_bindings = true;