]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix segfault (Issue 9236)
authorTilghman Lesher <tilghman@meg.abyt.es>
Thu, 8 Mar 2007 21:33:03 +0000 (21:33 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Thu, 8 Mar 2007 21:33:03 +0000 (21:33 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@58479 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_odbc.c

index 34f012de683bdef1383cc36cc3cc7c5be6b7c09f..2c1137cbe7d416490718c82ee2e3cdb3b92c37ee 100644 (file)
@@ -96,7 +96,7 @@ SQLHSTMT ast_odbc_prepare_and_execute(struct odbc_obj *obj, SQLHSTMT (*prepare_c
                        if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO) && (res != SQL_NO_DATA)) {
                                if (res == SQL_ERROR) {
                                        SQLGetDiagField(SQL_HANDLE_STMT, stmt, 1, SQL_DIAG_NUMBER, &numfields, SQL_IS_INTEGER, &diagbytes);
-                                       for (i=0; i< numfields + 1; i++) {
+                                       for (i = 0; i < numfields; i++) {
                                                SQLGetDiagRec(SQL_HANDLE_STMT, stmt, i + 1, state, &nativeerror, diagnostic, sizeof(diagnostic), &diagbytes);
                                                ast_log(LOG_WARNING, "SQL Execute returned an error %d: %s: %s (%d)\n", res, state, diagnostic, diagbytes);
                                                if (i > 10) {