0017647c65
Resolves: https://issues.redhat.com/browse/RHEL-24552 Signed-off-by: Pingfan Liu <piliu@redhat.com>
32 lines
859 B
Diff
32 lines
859 B
Diff
From fb42dae1e7c0c97b9a49a22e8f860882a26b3464 Mon Sep 17 00:00:00 2001
|
|
From: Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
|
|
Date: Mon, 4 Mar 2024 23:07:07 +0100
|
|
Subject: [PATCH 18/32] common: Replace malloc()+strncpy() with strdup()
|
|
|
|
This silences the stringop-truncation warning.
|
|
---
|
|
common/os/os_util.c | 4 +---
|
|
1 file changed, 1 insertion(+), 3 deletions(-)
|
|
|
|
diff --git a/common/os/os_util.c b/common/os/os_util.c
|
|
index 53bf405..3e4d5fc 100644
|
|
--- a/common/os/os_util.c
|
|
+++ b/common/os/os_util.c
|
|
@@ -387,12 +387,10 @@ str_int_extract(char *str, int *arr, int arr_size, int *num)
|
|
int len = strlen(str);
|
|
boolean_t ret = B_FALSE;
|
|
|
|
- if ((scopy = malloc(len + 1)) == NULL) {
|
|
+ if ((scopy = strdup(str)) == NULL) {
|
|
return (B_FALSE);
|
|
}
|
|
|
|
- strncpy(scopy, str, len + 1);
|
|
- scopy[len] = 0;
|
|
cur = scopy;
|
|
|
|
while (cur < (scopy + len)) {
|
|
--
|
|
2.41.0
|
|
|