Skip to content

Commit eeb234f

Browse files
committed
ncpfs: fix build warning of strncpy
Not upstream as ncpfs is long deleted. Fix up two strncpy build warnings in ncp_get_charsets() by using strscpy and the max size of the array. It's not like anyone uses this code anyway, and this gets rid of two build warnings so that we can see real warnings as they pop up over time. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c776cff commit eeb234f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fs/ncpfs/ioctl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ ncp_get_charsets(struct ncp_server* server, struct ncp_nls_ioctl __user *arg)
233233
len = strlen(server->nls_vol->charset);
234234
if (len > NCP_IOCSNAME_LEN)
235235
len = NCP_IOCSNAME_LEN;
236-
strncpy(user.codepage, server->nls_vol->charset, len);
236+
strscpy(user.codepage, server->nls_vol->charset, NCP_IOCSNAME_LEN);
237237
user.codepage[len] = 0;
238238
}
239239

@@ -243,7 +243,7 @@ ncp_get_charsets(struct ncp_server* server, struct ncp_nls_ioctl __user *arg)
243243
len = strlen(server->nls_io->charset);
244244
if (len > NCP_IOCSNAME_LEN)
245245
len = NCP_IOCSNAME_LEN;
246-
strncpy(user.iocharset, server->nls_io->charset, len);
246+
strscpy(user.iocharset, server->nls_io->charset, NCP_IOCSNAME_LEN);
247247
user.iocharset[len] = 0;
248248
}
249249
mutex_unlock(&server->root_setup_lock);

0 commit comments

Comments
 (0)