From ba94c350212ae7e794c4b4d40ed9ca5b23cb6ba1 Mon Sep 17 00:00:00 2001 From: "joonbum.ko" Date: Fri, 23 Mar 2018 16:47:18 +0900 Subject: [PATCH] Fixed some potential issues. - WGID : 305119 null-driver : NONTERMINATED_STRING - WGID : 305122 samples/tri.c : DEREF_AFTER_NULL Change-Id: I11ed1b1e05bb514c401793602dc81df064536379 Signed-off-by: joonbum.ko --- samples/tri.c | 1 - src/null-driver/null-driver.c | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/samples/tri.c b/samples/tri.c index 36560d1..df4734b 100644 --- a/samples/tri.c +++ b/samples/tri.c @@ -1792,7 +1792,6 @@ static void demo_create_window(struct demo *demo) { } wl_surface_set_user_data(demo->wl_surface, demo); - wl_shell_surface_set_title(demo->shell_surface, APP_SHORT_NAME); } #endif // _WIN32 diff --git a/src/null-driver/null-driver.c b/src/null-driver/null-driver.c index cc91a43..12b8b8d 100644 --- a/src/null-driver/null-driver.c +++ b/src/null-driver/null-driver.c @@ -29,6 +29,7 @@ */ #include "null-driver.h" +#include #include #include #include @@ -1458,9 +1459,7 @@ get_physical_device_properties(VkPhysicalDevice pdev, props->vendorID = 0; props->deviceID = 0; props->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER; - strncpy(props->deviceName, "nulldrv", strlen("nulldrv")); - if (strlen("nulldrv") < VK_MAX_PHYSICAL_DEVICE_NAME_SIZE) - props->deviceName[strlen("nulldrv")] = '\0'; + snprintf(props->deviceName, strlen("nulldrv") + 1, "nulldrv"); /* TODO: fill out limits */ memset(&props->limits, 0, sizeof(VkPhysicalDeviceLimits)); -- 2.7.4