put_item @brief Put information item in output buffer if there is room, and return an updated pointer. If there isn't room for the item, indicate truncation and return NULL. @param item @param length @param string @param ptr @param end **/
| 677 | |
| 678 | **/ |
| 679 | static UCHAR* put_item( UCHAR item, |
| 680 | const USHORT length, |
| 681 | const UCHAR* string, |
| 682 | UCHAR* ptr, |
| 683 | const UCHAR* const end) |
| 684 | { |
| 685 | if (ptr + length + 3 >= end) |
| 686 | { |
| 687 | *ptr = isc_info_truncated; |
| 688 | return NULL; |
| 689 | } |
| 690 | |
| 691 | *ptr++ = item; |
| 692 | |
| 693 | *ptr++ = (UCHAR) length; |
| 694 | *ptr++ = length >> 8; |
| 695 | |
| 696 | if (length) |
| 697 | memcpy(ptr, string, length); |
| 698 | |
| 699 | return ptr + length; |
| 700 | } |
| 701 | |
| 702 | |
| 703 | // Return as UTF8 |