ADO.Net (and some other APIs) returns the LVARCHAR buffer with a length that is 1 byte larger than it should be when the underlying c-tree data type is CT_STRING (which happens only for imported tables). The extra byte is set to '\0'. If the underlying c-tree data type is CT_4STRING or CT_2STRING this extra byte is not present. Logic has been modified to correct this.