BUG: srv_pfield Not Return Null if Field Length Is 30 Char.

Last reviewed: April 30, 1997
Article ID: Q124279

The information in this article applies to:
  • Microsoft SQL Server, versions 4.2 and 4.21
BUG# NT: 899 (4.2)

SYMPTOMS

The function srv_pfield does not return a null terminated string when the field length is exactly 30 characters. This may cause DB-Library (DB-Lib) 20003 errors if you pass this resultant string to DB-Lib login structure.

NOTE: The length returned is still correct.

WORKAROUND

The following code fragment can be used to ensure that a null terminated string of the correct length is copied into the destination buffer:

   char buf[31];
   strncpy(buf,srv_pfield(.....),30);
   strcat(buf,'\0');

STATUS

Microsoft has confirmed this to be a problem in OPENDSNT versions 4.2 and 4.21. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


Additional query words: ods dblib
Keywords : kbbug4.20 kbbug4.21 kbprg SSrvODS SSrvWinNT
Version : 4.2 4.21
Platform : WINDOWS
Resolution Type : kbcode


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.