From 37b024914db619d5b8a75ad1be1cbe662343536b Mon Sep 17 00:00:00 2001 From: adilger Date: Wed, 4 Sep 2002 09:28:54 +0000 Subject: [PATCH] Minor fixup - don't memcpy data from past end of string. Doesn't affect anyone except me, I think. --- lustre/obdclass/class_obd.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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; } -- 1.8.3.1