llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libunwind

Author: Michael Kenzel (michael-kenzel)

<details>
<summary>Changes</summary>

libunwind uses a minimum set of necessary standard library functions, basically 
just `memset` and `memcpy`. There is a single use of `strcpy` to copy the bytes 
`"CLNGUNW"` into a `uint64_t` object. This is both an arguably odd use of the 
`strcpy` function as well as it unnecessarily widens the set of library 
functions that must be available to build libunwind, which can be an obstacle 
in baremetal scenarios. This change simply replaces this one `strcpy` with the 
more fundamental `memcpy`.

---
Full diff: https://github.com/llvm/llvm-project/pull/72043.diff


1 Files Affected:

- (modified) libunwind/src/UnwindLevel1-gcc-ext.c (+1-1) 


``````````diff
diff --git a/libunwind/src/UnwindLevel1-gcc-ext.c 
b/libunwind/src/UnwindLevel1-gcc-ext.c
index d343f4e6e9cc837..32c872ffade1fd0 100644
--- a/libunwind/src/UnwindLevel1-gcc-ext.c
+++ b/libunwind/src/UnwindLevel1-gcc-ext.c
@@ -143,7 +143,7 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref) {
   // Create a mock exception object for force unwinding.
   _Unwind_Exception ex;
   memset(&ex, '\0', sizeof(ex));
-  strcpy((char *)&ex.exception_class, "CLNGUNW");
+  memcpy(&ex.exception_class, "CLNGUNW", sizeof(ex.exception_class));
 #endif
 
   // walk each frame

``````````

</details>


https://github.com/llvm/llvm-project/pull/72043
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to