[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v22 04/33] libtasn1: replace strcat() with strcpy() in _asn1_str_
From: |
Gary Lin |
Subject: |
[PATCH v22 04/33] libtasn1: replace strcat() with strcpy() in _asn1_str_cat() |
Date: |
Mon, 11 Nov 2024 15:44:38 +0800 |
strcat() is not available in GRUB. This commit replaces strcat() with
strcpy() in _asn1_str_cat() as the preparation to replace other strcat()
with the bounds-checking _asn1_str_cat().
Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
...-strcat-with-strcpy-in-_asn1_str_cat.patch | 33 +++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644
grub-core/lib/libtasn1-patches/0002-libtasn1-replace-strcat-with-strcpy-in-_asn1_str_cat.patch
diff --git
a/grub-core/lib/libtasn1-patches/0002-libtasn1-replace-strcat-with-strcpy-in-_asn1_str_cat.patch
b/grub-core/lib/libtasn1-patches/0002-libtasn1-replace-strcat-with-strcpy-in-_asn1_str_cat.patch
new file mode 100644
index 000000000..908016df7
--- /dev/null
+++
b/grub-core/lib/libtasn1-patches/0002-libtasn1-replace-strcat-with-strcpy-in-_asn1_str_cat.patch
@@ -0,0 +1,33 @@
+From 93453558fbe34634096770933b3dc40c9199dfb4 Mon Sep 17 00:00:00 2001
+From: Gary Lin <glin@suse.com>
+Date: Tue, 20 Aug 2024 16:14:51 +0800
+Subject: [PATCH 02/13] libtasn1: replace strcat() with strcpy() in
+ _asn1_str_cat()
+
+strcat() is not available in GRUB. This commit replaces strcat() with
+strcpy() in _asn1_str_cat() as the preparation to replace other strcat()
+with the bounds-checking _asn1_str_cat().
+
+Signed-off-by: Daniel Axtens <dja@axtens.net>
+Signed-off-by: Gary Lin <glin@suse.com>
+Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+---
+ grub-core/lib/libtasn1-grub/lib/gstr.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/grub-core/lib/libtasn1-grub/lib/gstr.c
b/grub-core/lib/libtasn1-grub/lib/gstr.c
+index eef419554..a9c16f5d3 100644
+--- a/grub-core/lib/libtasn1-grub/lib/gstr.c
++++ b/grub-core/lib/libtasn1-grub/lib/gstr.c
+@@ -36,7 +36,7 @@ _asn1_str_cat (char *dest, size_t dest_tot_size, const char
*src)
+
+ if (dest_tot_size - dest_size > str_size)
+ {
+- strcat (dest, src);
++ strcpy (dest + dest_size, src);
+ }
+ else
+ {
+--
+2.43.0
+
--
2.43.0
- [PATCH v22 00/33] Automatic Disk Unlock with TPM2, Gary Lin, 2024/11/11
- [PATCH v22 01/33] posix_wrap: tweaks in preparation for libtasn1, Gary Lin, 2024/11/11
- [PATCH v22 02/33] libtasn1: import libtasn1-4.19.0, Gary Lin, 2024/11/11
- [PATCH v22 03/33] libtasn1: disable code not needed in grub, Gary Lin, 2024/11/11
- [PATCH v22 07/33] libtasn1: Use grub_divmod64() for division, Gary Lin, 2024/11/11
- [PATCH v22 10/33] asn1_test: rename the main functions to the test names, Gary Lin, 2024/11/11
- [PATCH v22 04/33] libtasn1: replace strcat() with strcpy() in _asn1_str_cat(),
Gary Lin <=
- [PATCH v22 05/33] libtasn1: replace strcat() with _asn1_str_cat(), Gary Lin, 2024/11/11
- [PATCH v22 08/33] libtasn1: fix the potential buffer overrun, Gary Lin, 2024/11/11
- [PATCH v22 11/33] asn1_test: return either 0 or 1 to reflect the results, Gary Lin, 2024/11/11
- [PATCH v22 06/33] libtasn1: adjust the header paths in libtasn1.h, Gary Lin, 2024/11/11
- [PATCH v22 14/33] asn1_test: use the grub-specific functions and types, Gary Lin, 2024/11/11
- [PATCH v22 09/33] asn1_test: include asn1_test.h only, Gary Lin, 2024/11/11
- [PATCH v22 13/33] asn1_test: print the error messages with grub_printf(), Gary Lin, 2024/11/11
- [PATCH v22 18/33] libtasn1: Add the documentation, Gary Lin, 2024/11/11
- [PATCH v22 16/33] libtasn1: compile into asn1 module, Gary Lin, 2024/11/11
- [PATCH v22 19/33] key_protector: Add key protectors framework, Gary Lin, 2024/11/11