From e9f8db2255cb121692ec64583cf31ac994aaaa92 Mon Sep 17 00:00:00 2001 From: pbalcer Date: Wed, 6 Jul 2022 15:01:43 +0200 Subject: [PATCH 1/2] examples: fix potential buffer overflow in pmemobjfs example --- src/examples/libpmemobj/pmemobjfs/pmemobjfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/examples/libpmemobj/pmemobjfs/pmemobjfs.c b/src/examples/libpmemobj/pmemobjfs/pmemobjfs.c index a4374717c73..a3d4ae6d4e9 100644 --- a/src/examples/libpmemobj/pmemobjfs/pmemobjfs.c +++ b/src/examples/libpmemobj/pmemobjfs/pmemobjfs.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -/* Copyright 2015-2019, Intel Corporation */ +/* Copyright 2015-2022, Intel Corporation */ /* * pmemobjfs.c -- simple filesystem based on libpmemobj tx API @@ -2210,7 +2210,7 @@ parse_size(const char *str, uint64_t *sizep) { uint64_t size = 0; int shift = 0; - char unit[3] = {0}; + char unit[4] = {0}; int ret = sscanf(str, "%lu%3s", &size, unit); if (ret <= 0) return -1; From 9922412e1e6ee4b2497aae48c808d30f02dffb2f Mon Sep 17 00:00:00 2001 From: pbalcer Date: Wed, 6 Jul 2022 15:03:05 +0200 Subject: [PATCH 2/2] pmem: suppress a potential unused parameters warning Reported-by: Jeff Olivier --- src/libpmem/pmem.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libpmem/pmem.h b/src/libpmem/pmem.h index 7cf6bf13cfa..ad5d75fcbac 100644 --- a/src/libpmem/pmem.h +++ b/src/libpmem/pmem.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright 2014-2020, Intel Corporation */ +/* Copyright 2014-2022, Intel Corporation */ /* * pmem.h -- internal definitions for libpmem @@ -41,6 +41,8 @@ static inline void pmem_inject_fault_at(enum pmem_allocation_type type, int nth, const char *at) { + SUPPRESS_UNUSED(type, nth, at); + abort(); }