Merge pull request #365 from vitalif/master

Don't try to ZDR_DECODE strings into a pre-existing pointer
master
Ronnie Sahlberg 2021-10-11 21:39:24 +10:00 committed by GitHub
commit 81f4609076
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 8 deletions

View File

@ -297,15 +297,11 @@ bool_t libnfs_zdr_string(ZDR *zdrs, char **strp, uint32_t maxsize)
* in place.
*/
if (zdrs->size > zdrs->pos + (int)size && zdrs->buf[zdrs->pos + size] == 0) {
if (*strp == NULL) {
*strp = &zdrs->buf[zdrs->pos];
(*strp)[size] = 0;
zdrs->pos += size;
zdrs->pos = (zdrs->pos + 3) & ~3;
return TRUE;
}
*strp = &zdrs->buf[zdrs->pos];
(*strp)[size] = 0;
return libnfs_zdr_opaque(zdrs, *strp, size);
zdrs->pos += size;
zdrs->pos = (zdrs->pos + 3) & ~3;
return TRUE;
}
/* Crap. The string is not null terminated in the rx buffer.