1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
Description: Fix ftbfs with GCC
Use strdup() instead of using malloc() and then copying the full length
of the string.
Author: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Bug-Debian: https://bugs.debian.org/925747
---
--- libkibi-0.1.1.orig/kibi/kibi.c
+++ libkibi-0.1.1/kibi/kibi.c
@@ -313,12 +313,11 @@ static char *get_xdg_config_home(void) {
xdg_config_home = getenv("XDG_CONFIG_HOME");
if(xdg_config_home != NULL && strlen(xdg_config_home) > 0) {
length = strlen(xdg_config_home) + 1;
- result = malloc(length);
+ result = strdup(xdg_config_home);
if(unlikely(result == NULL)) {
malloc_error(length);
return NULL;
}
- strncpy(result, xdg_config_home, length);
} else { // xdg_config_home == NULL || strlen(xdg_config_home) == 0
// Use $HOME/.config if XDG_CONFIG_HOME is not defined.
home = getenv("HOME");
|