X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-hook.c;fp=src%2Fafb-hook.c;h=d9fd1a37b7143c32f150588c160a35a232402e5e;hb=611893f7b9b39a0d3d4cb36d2af3924251af411b;hp=75e8a691fa31cf922c76e6f0d0a6bd0a7e7714e8;hpb=2e2bfa31dc97159b7630c3c2913a49147be818d2;p=src%2Fapp-framework-binder.git diff --git a/src/afb-hook.c b/src/afb-hook.c index 75e8a691..d9fd1a37 100644 --- a/src/afb-hook.c +++ b/src/afb-hook.c @@ -735,26 +735,26 @@ static void hook_api_event_make_cb(void *closure, const struct afb_hookid *hooki static void hook_api_rootdir_get_fd_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, int result) { - char path[PATH_MAX]; + char path[PATH_MAX], proc[100]; if (result < 0) _hook_api_(export, "rootdir_get_fd() -> %d, %m", result); else { - sprintf(path, "/proc/self/fd/%d", result); - readlink(path, path, sizeof path); + snprintf(proc, sizeof proc, "/proc/self/fd/%d", result); + readlink(proc, path, sizeof path); _hook_api_(export, "rootdir_get_fd() -> %d = %s", result, path); } } static void hook_api_rootdir_open_locale_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, const char *filename, int flags, const char *locale, int result) { - char path[PATH_MAX]; + char path[PATH_MAX], proc[100]; if (!locale) locale = "(null)"; if (result < 0) _hook_api_(export, "rootdir_open_locale(%s, %d, %s) -> %d, %m", filename, flags, locale, result); else { - sprintf(path, "/proc/self/fd/%d", result); - readlink(path, path, sizeof path); + snprintf(proc, sizeof proc, "/proc/self/fd/%d", result); + readlink(proc, path, sizeof path); _hook_api_(export, "rootdir_open_locale(%s, %d, %s) -> %d = %s", filename, flags, locale, result, path); } }