From: adilger Date: Wed, 4 Sep 2002 09:28:54 +0000 (+0000) Subject: Minor fixup - don't memcpy data from past end of string. X-Git-Tag: 0.5.6~2 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=37b024914db619d5b8a75ad1be1cbe662343536b;p=fs%2Flustre-release.git Minor fixup - don't memcpy data from past end of string. Doesn't affect anyone except me, I think. --- diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 5bbc664..53959c7 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -335,17 +335,16 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, if (data->ioc_inlbuf3) { int len = strlen(data->ioc_inlbuf3); - if (len > 37) { - CERROR("uuid should be shorter than 37 bytes\n"); + if (len >= sizeof(obd->obd_uuid)) { + CERROR("uuid must be < %d bytes long\n", + sizeof(obd->obd_uuid)); if (obd->obd_name) OBD_FREE(obd->obd_name, strlen(obd->obd_name) + 1); GOTO(out, err=-EINVAL); } - memcpy(obd->obd_uuid, data->ioc_inlbuf3, - sizeof(obd->obd_uuid)); + memcpy(obd->obd_uuid, data->ioc_inlbuf3, len); } - MOD_INC_USE_COUNT; }