Skip to content
Snippets Groups Projects
Commit 918d5f0d authored by Steven Murray's avatar Steven Murray
Browse files

bug #96536: rmlabelinfo() of tape/initlabel.c corrupts memory if called more than once

In order to improve logging for tape-operations and to facilitate the current
testing surrounding this bug, the serrno code of ENOMEM has been replaced by
the more specific error ETNOLBLINFOMEM meaning "No memory available for label
information" within the setlabelinfo function.
parent 60c83be6
Branches
Tags
No related merge requests found
......@@ -341,6 +341,7 @@ char *sys_terrlist[ETMAXERR-ETBASEOFF+2] =
"castor::tape::net::acceptConnection interrupted",
"Label information not found in memory",
"Multi-drive reservations are not supported",
"No memory available for label information",
"BAD ERROR NUMBER"
};
......
......@@ -345,7 +345,8 @@
#define ETNETACCEPTINTR ETBASEOFF+34 /* castor::tape::net::acceptConnection interrupted */
#define ETNOLBLINFO ETBASEOFF+35 /* Label information not found in memory */
#define ETMLTDRVRSV ETBASEOFF+36 /* Multi-drive reservations are not supported */
#define ETMAXERR ETBASEOFF+36
#define ETNOLBLINFOMEM ETBASEOFF+37 /* No memory available for label information */
#define ETMAXERR ETBASEOFF+37
/*
*------------------------------------------------------------------------
......
......@@ -249,6 +249,9 @@ Wrong vsn.
.TP
.B ETNOLBLINFO
Label information not found in memory.
.TP
.B ETNOLBLINFOMEM
No memory available for label information.
.SH SEE ALSO
.BR vdqm_SendVolReq(3)
.SH AUTHOR
......
......@@ -91,7 +91,7 @@ int setdevinfo (const char *const path,
/* has a value for another path */
if (s_devlblinfoHasValue &&
strncmp(s_devlblinfo.path, path, sizeof(s_devlblinfo.path))) {
serrno = ENOMEM;
serrno = ETNOLBLINFOMEM;
return (-1);
}
......
......@@ -163,7 +163,7 @@ public:
/**
* Calling setdevinfo() a second time with a differnet path and without
* calling rmlabelinfo() should return -1 and set serrno to ENOMEM.
* calling rmlabelinfo() should return -1 and set serrno to ETNOLBLINFOMEM.
*/
void testSetdevinfoTwiceWithDifferentPaths() {
CPPUNIT_ASSERT_EQUAL_MESSAGE(
......@@ -178,7 +178,7 @@ public:
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Checking setlabelinfo sets serrno occordingly",
ENOMEM,
ETNOLBLINFOMEM,
serrno);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment