Whamcloud - gitweb
Minor fixup - don't memcpy data from past end of string.
authoradilger <adilger>
Wed, 4 Sep 2002 09:28:54 +0000 (09:28 +0000)
committeradilger <adilger>
Wed, 4 Sep 2002 09:28:54 +0000 (09:28 +0000)
Doesn't affect anyone except me, I think.

lustre/obdclass/class_obd.c

index 5bbc664..53959c7 100644 (file)
@@ -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;
                 }