tools/ccan_depends --compile ccan/module (without a trailing slash)
results in a segfault.
char **deps;
char *updir = talloc_strdup(m, m->dir);
char **deps;
char *updir = talloc_strdup(m, m->dir);
- *strrchr(updir, '/') = '\0';
+ if (strrchr(updir, '/'))
+ *strrchr(updir, '/') = '\0';
if (safe_mode)
deps = get_safe_ccan_deps(m, m->dir, true,
if (safe_mode)
deps = get_safe_ccan_deps(m, m->dir, true,
return NULL;
ccandir = talloc_dirname(ctx, dir);
return NULL;
ccandir = talloc_dirname(ctx, dir);
- *strrchr(ccandir, '/') = '\0';
+ if (strrchr(ccandir, '/'))
+ *strrchr(ccandir, '/') = '\0';
compiled = maybe_temp_file(ctx, "", false, "info");
if (compile_and_link(ctx, info_c_file, ccandir, "",
compiled = maybe_temp_file(ctx, "", false, "info");
if (compile_and_link(ctx, info_c_file, ccandir, "",