staging: unisys: include: uisutils.h: Cleaning up missing null-terminate in conjuncti...
authorRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Sat, 26 Jul 2014 14:41:46 +0000 (16:41 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 27 Jul 2014 18:39:45 +0000 (11:39 -0700)
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/include/uisutils.h

index 70776c93cc50484f79e33267efa46ea2ff3d4257..14d5cbda594ac2f2084f039c8757fa14747d8f5b 100644 (file)
@@ -307,20 +307,20 @@ Issue_VMCALL_CHANNEL_MISMATCH(const char *ChannelName,
        U64 physaddr;
        char *last_slash = NULL;
 
-       strncpy(params.ChannelName, ChannelName,
+       strlcpy(params.ChannelName, ChannelName,
                lengthof(VMCALL_CHANNEL_VERSION_MISMATCH_PARAMS, ChannelName));
-       strncpy(params.ItemName, ItemName,
+       strlcpy(params.ItemName, ItemName,
                lengthof(VMCALL_CHANNEL_VERSION_MISMATCH_PARAMS, ItemName));
        params.SourceLineNumber = SourceLineNumber;
 
        last_slash = strrchr(path_n_fn, '/');
        if (last_slash != NULL) {
                last_slash++;
-               strncpy(params.SourceFileName, last_slash,
+               strlcpy(params.SourceFileName, last_slash,
                        lengthof(VMCALL_CHANNEL_VERSION_MISMATCH_PARAMS,
                                 SourceFileName));
        } else
-               strncpy(params.SourceFileName,
+               strlcpy(params.SourceFileName,
                        "Cannot determine source filename",
                        lengthof(VMCALL_CHANNEL_VERSION_MISMATCH_PARAMS,
                                 SourceFileName));