| 977 | |
| 978 | |
| 979 | UCHAR* INF_put_item(UCHAR item, |
| 980 | ULONG length, |
| 981 | const void* data, |
| 982 | UCHAR* ptr, |
| 983 | const UCHAR* end, |
| 984 | const bool inserting) |
| 985 | { |
| 986 | /************************************** |
| 987 | * |
| 988 | * I N F _ p u t _ i t e m |
| 989 | * |
| 990 | ************************************** |
| 991 | * |
| 992 | * Functional description |
| 993 | * Put information item in output buffer if there is room, and |
| 994 | * return an updated pointer. If there isn't room for the item, |
| 995 | * indicate truncation and return NULL. |
| 996 | * If we are inserting, we don't need space for isc_info_end, since it was calculated already. |
| 997 | * |
| 998 | **************************************/ |
| 999 | |
| 1000 | if ((ptr + length + (inserting ? 3 : 4) >= end) || (length > MAX_USHORT)) |
| 1001 | { |
| 1002 | if (ptr < end) |
| 1003 | { |
| 1004 | *ptr++ = isc_info_truncated; |
| 1005 | if (ptr < end && !inserting) |
| 1006 | *ptr++ = isc_info_end; |
| 1007 | } |
| 1008 | return NULL; |
| 1009 | } |
| 1010 | |
| 1011 | *ptr++ = item; |
| 1012 | STUFF_WORD(ptr, length); |
| 1013 | |
| 1014 | if (length) |
| 1015 | { |
| 1016 | memmove(ptr, data, length); |
| 1017 | ptr += length; |
| 1018 | } |
| 1019 | |
| 1020 | return ptr; |
| 1021 | } |
| 1022 | |
| 1023 | |
| 1024 | ULONG INF_request_info(const Request* request, |
no outgoing calls
no test coverage detected