pan/decode: Fix missing NULL terminator
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 16 Aug 2019 23:31:54 +0000 (16:31 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 21 Aug 2019 15:40:52 +0000 (08:40 -0700)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/panfrost/pandecode/common.c

index 6154b3cd505eb487dde356063422c67c7ed510dd..0678e459066005b8f9eecabad60eb663731f9814 100644 (file)
@@ -65,8 +65,8 @@ pandecode_inject_mmap(uint64_t gpu_va, void *cpu, unsigned sz, const char *name)
                 snprintf(mapped_mem->name, ARRAY_SIZE(mapped_mem->name) - 1,
                          "memory_%" PRIx64, gpu_va);
         } else {
-                assert(strlen(name) < ARRAY_SIZE(mapped_mem->name));
-                memcpy(mapped_mem->name, name, strlen(name));
+                assert((strlen(name) + 1) < ARRAY_SIZE(mapped_mem->name));
+                memcpy(mapped_mem->name, name, strlen(name) + 1);
         }
 
         list_add(&mapped_mem->node, &mmaps.node);