From: Junkyeong Kim Date: Tue, 29 Dec 2020 07:57:25 +0000 (+0900) Subject: e_info_server: add null checking in _e_info_server_cb_screen_dump_cb X-Git-Tag: submit/tizen/20210104.034514~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F41%2F250541%2F3;p=platform%2Fupstream%2Fenlightenment.git e_info_server: add null checking in _e_info_server_cb_screen_dump_cb Change-Id: I78e446544c0dd9235396966ab9c15130f73c8fec Signed-off-by: Junkyeong Kim --- diff --git a/src/bin/e_info_server.c b/src/bin/e_info_server.c index 0e4b72d9ac..f693f7c851 100644 --- a/src/bin/e_info_server.c +++ b/src/bin/e_info_server.c @@ -4695,7 +4695,15 @@ _e_info_server_cb_screen_dump_cb(E_Output *eout, tbm_surface_h surface, void *us char *slash, *dot; int dlen = 0, flen = 0; + EINA_SAFETY_ON_NULL_GOTO(surface, done); + EINA_SAFETY_ON_NULL_GOTO(path, done); + slash = strrchr(path, '/'); + if (slash == NULL) + { + ERR("cannot find /"); + goto done; + } slash += 1; dlen = strnlen(path, PATH_MAX) - strnlen(slash, PATH_MAX); @@ -4708,6 +4716,11 @@ _e_info_server_cb_screen_dump_cb(E_Output *eout, tbm_surface_h surface, void *us dir[dlen] = '\0'; dot = strrchr(path, '.'); + if (dot == NULL) + { + ERR("cannot find ."); + goto done; + } flen = strnlen(slash, PATH_MAX) - strnlen(dot, PATH_MAX); if (flen <= 0) @@ -4727,8 +4740,10 @@ _e_info_server_cb_screen_dump_cb(E_Output *eout, tbm_surface_h surface, void *us DBG("_e_info_server_cb_screen_dump_cb done"); done: - free(path); - tbm_surface_destroy(surface); + if (path != NULL) + free(path); + if (surface != NULL) + tbm_surface_destroy(surface); } static Eldbus_Message *