|
| 1 | +--- a/libkmod/libkmod-config.c |
| 2 | ++++ b/libkmod/libkmod-config.c |
| 3 | +@@ -929,7 +929,9 @@ static int conf_files_insert_sorted(struct kmod_ctx *ctx, struct kmod_list **lis |
| 4 | + bool is_single = false; |
| 5 | + |
| 6 | + if (name == NULL) { |
| 7 | +- name = basename(path); |
| 8 | ++ char *pathc = strdup(path); |
| 9 | ++ name = basename(pathc); |
| 10 | ++ free(pathc); |
| 11 | + is_single = true; |
| 12 | + } |
| 13 | + |
| 14 | +--- a/shared/util.c |
| 15 | ++++ b/shared/util.c |
| 16 | +@@ -160,8 +160,10 @@ char *modname_normalize(const char *modname, char buf[static PATH_MAX], size_t * |
| 17 | + char *path_to_modname(const char *path, char buf[static PATH_MAX], size_t *len) |
| 18 | + { |
| 19 | + const char *modname; |
| 20 | ++ char *pathc = strdup(path); |
| 21 | + |
| 22 | +- modname = basename(path); |
| 23 | ++ modname = basename(pathc); |
| 24 | ++ free(pathc); |
| 25 | + if (modname == NULL || modname[0] == '\0') |
| 26 | + return NULL; |
| 27 | + |
| 28 | +--- a/tools/depmod.c |
| 29 | ++++ b/tools/depmod.c |
| 30 | +@@ -797,14 +797,17 @@ static int cfg_files_insert_sorted(struct cfg_file ***p_files, size_t *p_n_files |
| 31 | + struct cfg_file **files, *f; |
| 32 | + size_t i, n_files, namelen, dirlen; |
| 33 | + void *tmp; |
| 34 | ++ char *dirc; |
| 35 | + |
| 36 | + dirlen = strlen(dir); |
| 37 | + if (name != NULL) |
| 38 | + namelen = strlen(name); |
| 39 | + else { |
| 40 | +- name = basename(dir); |
| 41 | ++ dirc = strdup(dir); |
| 42 | ++ name = basename(dirc); |
| 43 | + namelen = strlen(name); |
| 44 | + dirlen -= namelen + 1; |
| 45 | ++ free(dirc); |
| 46 | + } |
| 47 | + |
| 48 | + n_files = *p_n_files; |
| 49 | +@@ -2621,7 +2624,7 @@ static int depmod_output(struct depmod *depmod, FILE *out) |
| 50 | + int fd; |
| 51 | + int n; |
| 52 | + |
| 53 | +- n = snprintf(tmp, sizeof(tmp), "%s.%i.%lli.%lli", itr->name, |
| 54 | ++ n = snprintf(tmp, sizeof(tmp), "%s.%i.%" PRId64 ".%" PRId64, itr->name, |
| 55 | + getpid(), (long long)tv.tv_usec, |
| 56 | + (long long)tv.tv_sec); |
| 57 | + if (n >= (int)sizeof(tmp)) { |
0 commit comments