diff options
author | Marcus Fritzsch <marcus.fritzsch@xse.de> | 2014-07-22 13:51:49 +0200 |
---|---|---|
committer | Nobuhiko Tanibata <NOBUHIKO_TANIBATA@denso.co.jp> | 2014-08-12 22:15:14 +0900 |
commit | 809a8013d9c80ddc37727c1ff4df7f4554f39131 (patch) | |
tree | defadc979c2003fa16fd3f06455cbe399e36a090 | |
parent | d951b3804595e537adfbbfb276544125a7ca4394 (diff) | |
download | wayland-ivi-extension-809a8013d9c80ddc37727c1ff4df7f4554f39131.tar.gz |
ilmControl: fix NULL deref in getPropertiesOfScreen
Signed-off-by: Marcus Fritzsch <marcus.fritzsch@xse.de>
-rw-r--r-- | ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c index 796878c..2709c6f 100644 --- a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c +++ b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c @@ -1513,24 +1513,21 @@ wayland_getPropertiesOfScreen(t_ilm_display screenID, struct ilmScreenProperties* pScreenProperties) { ilmErrorTypes returnValue = ILM_FAILED; - struct ilm_control_context *ctx = sync_and_acquire_instance(); - if (pScreenProperties != NULL) { - struct screen_context *ctx_screen = NULL; - ctx_screen = get_screen_context_by_id(&ctx->wl, (uint32_t)screenID); - if (ctx_screen != NULL) { - *pScreenProperties = ctx_screen->prop; - create_layerids(ctx_screen, &pScreenProperties->layerIds, - &pScreenProperties->layerCount); - returnValue = ILM_SUCCESS; - } + if (! pScreenProperties) + { + return ILM_ERROR_INVALID_ARGUMENTS; } - else { - pScreenProperties->layerCount = 0; - pScreenProperties->harwareLayerCount = 0; - pScreenProperties->layerIds = NULL; - pScreenProperties->screenWidth = 0; - pScreenProperties->screenHeight = 0; + + struct ilm_control_context *ctx = sync_and_acquire_instance(); + + struct screen_context *ctx_screen = NULL; + ctx_screen = get_screen_context_by_id(&ctx->wl, (uint32_t)screenID); + if (ctx_screen != NULL) { + *pScreenProperties = ctx_screen->prop; + create_layerids(ctx_screen, &pScreenProperties->layerIds, + &pScreenProperties->layerCount); + returnValue = ILM_SUCCESS; } release_instance(); |