$OpenBSD: patch-src_iodbc_herr_c,v 1.1.1.1 2004/07/16 21:01:35 todd Exp $ --- src/iodbc/herr.c.orig Wed Jun 2 01:31:41 1999 +++ src/iodbc/herr.c Wed Apr 30 10:03:24 2003 @@ -291,15 +291,13 @@ SQLError ( if (ststr == NULL) { - len = 0; + szSqlstate[0] = 0; } else { - len = (int) STRLEN (ststr); + strlcpy (szSqlstate, ststr, 6); } - STRNCPY (szSqlstate, ststr, len); - szSqlstate[len] = 0; /* buffer size of szSqlstate is not checked. Applications * suppose provide enough ( not less than 6 bytes ) buffer * or NULL for it. @@ -347,8 +345,7 @@ SQLError ( /* and not posts error for itself */ } - STRNCPY ((char *) szErrorMsg, msgbuf, len); - szErrorMsg[len] = 0; + strlcpy ((char *) szErrorMsg, msgbuf, len); if (pcbErrorMsg != NULL) {