nfs4: Fix wrong parenthesising in ReplyInterpreter::_FlattenPathname
This patch solves CID 990966.
This commit is contained in:
@@ -522,17 +522,17 @@ ReplyInterpreter::Write(uint32* size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const char*
|
const char*
|
||||||
sFlattenPathname(XDR::ReadStream& str)
|
ReplyInterpreter::_FlattenPathname(XDR::ReadStream& stream)
|
||||||
{
|
{
|
||||||
uint32 count = str.GetUInt();
|
uint32 count = stream.GetUInt();
|
||||||
char* pathname = NULL;
|
char* pathname = NULL;
|
||||||
uint32 size = 0;
|
uint32 size = 0;
|
||||||
for (uint32 i = 0; i < count; i++) {
|
for (uint32 i = 0; i < count; i++) {
|
||||||
const char* path = str.GetString();
|
const char* path = stream.GetString();
|
||||||
size += strlen(path) + 1;
|
size += strlen(path) + 1;
|
||||||
if (pathname == NULL) {
|
if (pathname == NULL) {
|
||||||
pathname = reinterpret_cast<char*>(malloc(strlen(path + 1)));
|
pathname = reinterpret_cast<char*>(malloc(strlen(path) + 1));
|
||||||
pathname[0] = '\0';
|
pathname[0] = '\0';
|
||||||
} else {
|
} else {
|
||||||
*pathname++ = '/';
|
*pathname++ = '/';
|
||||||
@@ -657,11 +657,11 @@ ReplyInterpreter::_DecodeAttrs(XDR::ReadStream& str, AttrValue** attrs,
|
|||||||
values[current].fAttribute = FATTR4_FS_LOCATIONS;
|
values[current].fAttribute = FATTR4_FS_LOCATIONS;
|
||||||
|
|
||||||
FSLocations* locs = new FSLocations;
|
FSLocations* locs = new FSLocations;
|
||||||
locs->fRootPath = sFlattenPathname(stream);
|
locs->fRootPath = _FlattenPathname(stream);
|
||||||
locs->fCount = stream.GetUInt();
|
locs->fCount = stream.GetUInt();
|
||||||
locs->fLocations = new FSLocation[locs->fCount];
|
locs->fLocations = new FSLocation[locs->fCount];
|
||||||
for (uint32 i = 0; i < locs->fCount; i++) {
|
for (uint32 i = 0; i < locs->fCount; i++) {
|
||||||
locs->fLocations[i].fRootPath = sFlattenPathname(stream);
|
locs->fLocations[i].fRootPath = _FlattenPathname(stream);
|
||||||
locs->fLocations[i].fCount = stream.GetUInt();
|
locs->fLocations[i].fCount = stream.GetUInt();
|
||||||
locs->fLocations[i].fLocations
|
locs->fLocations[i].fLocations
|
||||||
= new const char*[locs->fLocations[i].fCount];
|
= new const char*[locs->fLocations[i].fCount];
|
||||||
|
|||||||
@@ -108,6 +108,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
void _ParseHeader();
|
void _ParseHeader();
|
||||||
|
|
||||||
|
static const char* _FlattenPathname(XDR::ReadStream& stream);
|
||||||
|
|
||||||
status_t _DecodeAttrs(XDR::ReadStream& stream, AttrValue** attrs,
|
status_t _DecodeAttrs(XDR::ReadStream& stream, AttrValue** attrs,
|
||||||
uint32* count);
|
uint32* count);
|
||||||
status_t _OperationError(Opcode op);
|
status_t _OperationError(Opcode op);
|
||||||
|
|||||||
Reference in New Issue
Block a user