MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / xdr_cstring_const

Function xdr_cstring_const

src/remote/protocol.cpp:1361–1376  ·  view source on GitHub ↗

CVC: This function is a little stub to validate that indeed, bpb's aren't overwritten by accident. Even though xdr_string writes to cstr_address, an action we wanted to block, it first allocates a new buffer. The problem is that bpb's aren't copied, but referenced by address, so we don't want a const param being hijacked and its memory location overwritten. The same test has been applied to put_se

Source from the content-addressed store, hash-verified

1359// places of the code, so only P_BLOB was changed to use CSTRING_CONST.
1360// The same function is being used to check P_SGMT & P_DDL.
1361static inline bool_t xdr_cstring_const(RemoteXdr* xdrs, CSTRING_CONST* cstring)
1362{
1363 if (xdr_is_client(xdrs) && xdrs->x_op == XDR_DECODE)
1364 {
1365 fb_assert(!(cstring->cstr_length <= cstring->cstr_allocated && cstring->cstr_allocated));
1366
1367 if (!cstring->cstr_allocated)
1368 {
1369 // Normally we should not decode into such CSTRING_CONST at client side
1370 // May be op, normally never sent to client, was received
1371 cstring->cstr_address = nullptr;
1372 cstring->cstr_length = 0;
1373 }
1374 }
1375 return xdr_cstring(xdrs, reinterpret_cast<CSTRING*>(cstring));
1376}
1377
1378static inline bool_t xdr_response(RemoteXdr* xdrs, CSTRING* cstring)
1379{

Callers

nothing calls this directly

Calls 2

xdr_is_clientFunction · 0.85
xdr_cstringFunction · 0.85

Tested by

no test coverage detected