about summary refs log tree commit diff
path: root/pkgs/applications/virtualization/virtualbox/guest-additions/strlcpy-1.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/virtualization/virtualbox/guest-additions/strlcpy-1.patch')
-rw-r--r--pkgs/applications/virtualization/virtualbox/guest-additions/strlcpy-1.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/pkgs/applications/virtualization/virtualbox/guest-additions/strlcpy-1.patch b/pkgs/applications/virtualization/virtualbox/guest-additions/strlcpy-1.patch
new file mode 100644
index 000000000000..642f5864d208
--- /dev/null
+++ b/pkgs/applications/virtualization/virtualbox/guest-additions/strlcpy-1.patch
@@ -0,0 +1,29 @@
+# https://www.virtualbox.org/changeset/102989/vbox
+--- a/include/iprt/string.h
++++ b/include/iprt/string.h
+@@ -244,4 +244,26 @@
+ #else  /* !RT_OS_LINUX && !__KERNEL__ */
+ # define RT_BCOPY_UNFORTIFIED(a_pDst, a_pSrc, a_cbToCopy)   memcpy((a_pDst), (a_pSrc), (a_cbToCopy))
++#endif /* !RT_OS_LINUX && !__KERNEL__ */
++
++/** @def RT_STRSCPY
++ * Copy string and NULL-terminate output buffer.
++ *
++ * This macro should mostly be used in Linux kernel code. This is
++ * the replacement for deprecated strlcpy. It was deprecated since 3.16.60
++ * when strscpy was introduced as an alternative. Finally, strlcpy was
++ * completely removed from kernel code in 6.8.0.
++ *
++ * @param   a_pDst          Pointer to the destination string buffer.
++ * @param   a_pSrc          Pointer to the source NULL-terminated string buffer.
++ * @param   a_cbToCopy      Size of destination buffer..
++ */
++#if defined(RT_OS_LINUX) && defined(__KERNEL__)
++# if (RTLNX_VER_MIN(3,16,60))
++#  define RT_STRSCPY(a_pDst, a_pSrc, a_cbToCopy)    strscpy((a_pDst), (a_pSrc), (a_cbToCopy))
++# else /* < 3.16.60 */
++#  define RT_STRSCPY(a_pDst, a_pSrc, a_cbToCopy)    strlcpy((a_pDst), (a_pSrc), (a_cbToCopy))
++# endif
++#else  /* !RT_OS_LINUX && !__KERNEL__ */
++# define RT_STRSCPY(a_pDst, a_pSrc, a_cbToCopy)    strscpy((a_pDst), (a_pSrc), (a_cbToCopy))
+ #endif /* !RT_OS_LINUX && !__KERNEL__ */