From 078fc6e4c24a9a8b66d251f0136604b5e7a72e5d Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 31 Jul 2019 14:05:45 +0000 Subject: [PATCH] usr/fileio/common.c: Suppress a compiler warning (merge r8257 from trunk) git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.3.x@8492 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- usr/fileio/common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr/fileio/common.c b/usr/fileio/common.c index def2c36ae..46f8428a7 100644 --- a/usr/fileio/common.c +++ b/usr/fileio/common.c @@ -996,9 +996,11 @@ static void exec_inquiry(struct vdisk_cmd *vcmd) resp_len = buf[3] + 6; } else if (0x80 == cmd->cdb[2]) { /* unit serial number */ int usn_len = strlen(dev->usn); + buf[1] = 0x80; buf[3] = usn_len; - strncpy((char *)&buf[4], dev->usn, usn_len); + assert(4 + usn_len <= sizeof(buf)); + memcpy(&buf[4], dev->usn, usn_len); resp_len = buf[3] + 4; } else if (0x83 == cmd->cdb[2]) { /* device identification */ int num = 4;