File kernel-6.8.patch of Package virtualbox

From: Jiri Slaby <jslaby@suse.cz>
Subject: fix build with Linux 6.8
Patch-mainline: no
References: kernel 6.8

strlcpy() was removed in commit d26270061ae6 (string: Remove strlcpy()), use
strscpy() instead.

The patches fixes this (and similar):
modules_build_dir/default/vboxsf/vfsmod.c:1411:9: error: implicit declaration of function ‘strlcpy’; did you mean ‘strscpy’?


Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 src/VBox/Additions/common/VBoxGuest/VBoxGuest-linux.c |    6 +++---
 src/VBox/Additions/linux/sharedfolders/vfsmod.c       |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

Index: VirtualBox-7.0.14/src/VBox/Additions/common/VBoxGuest/VBoxGuest-linux.c
===================================================================
--- VirtualBox-7.0.14.orig/src/VBox/Additions/common/VBoxGuest/VBoxGuest-linux.c
+++ VirtualBox-7.0.14/src/VBox/Additions/common/VBoxGuest/VBoxGuest-linux.c
@@ -1361,7 +1361,7 @@ static int vgdrvLinuxParamLogGrpSet(cons
             RTLogGroupSettings(pLogger, pszValue);
     }
     else if (pParam->name[0] != 'd')
-        strlcpy(&g_szLogGrp[0], pszValue, sizeof(g_szLogGrp));
+        strscpy(&g_szLogGrp[0], pszValue, sizeof(g_szLogGrp));
 
     return 0;
 }
@@ -1387,7 +1387,7 @@ static int vgdrvLinuxParamLogFlagsSet(co
             RTLogFlags(pLogger, pszValue);
     }
     else if (pParam->name[0] != 'd')
-        strlcpy(&g_szLogFlags[0], pszValue, sizeof(g_szLogFlags));
+        strscpy(&g_szLogFlags[0], pszValue, sizeof(g_szLogFlags));
     return 0;
 }
 
@@ -1412,7 +1412,7 @@ static int vgdrvLinuxParamLogDstSet(cons
             RTLogDestinations(pLogger, pszValue);
     }
     else if (pParam->name[0] != 'd')
-        strlcpy(&g_szLogDst[0], pszValue, sizeof(g_szLogDst));
+        strscpy(&g_szLogDst[0], pszValue, sizeof(g_szLogDst));
     return 0;
 }
 
Index: VirtualBox-7.0.14/src/VBox/Additions/linux/sharedfolders/vfsmod.c
===================================================================
--- VirtualBox-7.0.14.orig/src/VBox/Additions/linux/sharedfolders/vfsmod.c
+++ VirtualBox-7.0.14/src/VBox/Additions/linux/sharedfolders/vfsmod.c
@@ -1408,7 +1408,7 @@ static int vbsf_parse_param(struct fs_co
     switch (opt) {
     case Opt_iocharset:
     case Opt_nls:
-        strlcpy(info->nls_name, param->string, sizeof(info->nls_name));
+        strscpy(info->nls_name, param->string, sizeof(info->nls_name));
         break;
     case Opt_uid:
         info->uid = result.uint_32;
@@ -1469,7 +1469,7 @@ static int vbsf_parse_param(struct fs_co
             printk(KERN_WARNING "vboxsf: cache mode (%u) is out of range, using default instead.\n", result.uint_32);
         break;
     case Opt_tag:
-        strlcpy(info->szTag, param->string, sizeof(info->szTag));
+        strscpy(info->szTag, param->string, sizeof(info->szTag));
         break;
     default:
         return invalf(fc, "Invalid mount option: '%s'", param->key);
@@ -1528,7 +1528,7 @@ static int vbsf_get_tree(struct fs_conte
     }
 
     /* fc->source (the shared folder name) is set after vbsf_init_fs_ctx() */
-    strlcpy(info->name, fc->source, sizeof(info->name));
+    strscpy(info->name, fc->source, sizeof(info->name));
 
 # if RTLNX_VER_MAX(5,3,0)
     return vfs_get_super(fc, vfs_get_independent_super, vbsf_read_super_aux);
openSUSE Build Service is sponsored by