46 lines
1.3 KiB
Diff
46 lines
1.3 KiB
Diff
From 6f0a9e9a1ce574b5b2d28fbf986bf551d38b3832 Mon Sep 17 00:00:00 2001
|
|
From: Huaxin Lu <luhuaxin1@huawei.com>
|
|
Date: Thu, 9 May 2024 15:56:17 +0800
|
|
Subject: [PATCH 14/28] dont warp strncpy
|
|
|
|
---
|
|
src/common/dim_baseline.c | 2 +-
|
|
src/common/dim_safe_func.h | 10 +---------
|
|
2 files changed, 2 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/src/common/dim_baseline.c b/src/common/dim_baseline.c
|
|
index 3272ded..17c58dd 100644
|
|
--- a/src/common/dim_baseline.c
|
|
+++ b/src/common/dim_baseline.c
|
|
@@ -106,7 +106,7 @@ int dim_baseline_add(struct dim_baseline_tree *root, const char *name,
|
|
if (ret < 0)
|
|
goto err;
|
|
|
|
- dim_strncpy((char *)baseline->name, name, buf_len - 1);
|
|
+ strncpy((char *)baseline->name, name, buf_len - 1);
|
|
((char *)baseline->name)[buf_len - 1] = '\0';
|
|
|
|
write_lock(&root->lock);
|
|
diff --git a/src/common/dim_safe_func.h b/src/common/dim_safe_func.h
|
|
index 15c716c..8cba7b2 100644
|
|
--- a/src/common/dim_safe_func.h
|
|
+++ b/src/common/dim_safe_func.h
|
|
@@ -132,12 +132,4 @@ static inline int dim_strncmp(const char *cs, const char *ct, size_t count)
|
|
return strncmp(cs, ct, count);
|
|
}
|
|
|
|
-static inline char *dim_strncpy(char *dest, const char *src, size_t count)
|
|
-{
|
|
- if (dest == NULL || src == NULL)
|
|
- return NULL;
|
|
-
|
|
- return strncpy(dest, src, count);
|
|
-}
|
|
-
|
|
-#endif
|
|
\ No newline at end of file
|
|
+#endif
|
|
--
|
|
2.33.0
|
|
|