]> git.ozlabs.org Git - ccan/blobdiff - tools/depends.c
tools: Fixed unchecked *strrchr in a couple places.
[ccan] / tools / depends.c
index 870f1e49dd7618073a6b97762c799f819698a891..82524da0a256977ac61191f8ebf2b8d689e5eace 100644 (file)
@@ -59,7 +59,8 @@ static char *compile_info(const void *ctx, const char *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, "",