diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index 7af0d9ffdd..043aa42b55 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -3014,7 +3014,7 @@ GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index, /* If the volume does not exist, create it */ if (!volid || code) { - char volname[64]; + char volname[VL_MAXNAMELEN]; char hoststr[16]; if (volid && (code != VNOVOL)) { @@ -3023,7 +3023,16 @@ GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index, goto fail; } - strcpy(volname, vldbEntryPtr->name); + strlcpy(volname, vldbEntryPtr->name, sizeof(volname)); + + if (strlcat(volname, + tmpVolId?".roclone":".readonly", + sizeof(volname)) >= sizeof(volname)) { + code = ENOMEM; + PrintError("Volume name is too long\n", code); + goto fail; + } + if (tmpVolId) strcat(volname, ".roclone"); else