multi: Fix check for opt Records in present response
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 28 Sep 2012 12:26:09 +0000 (14:26 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 28 Sep 2012 12:26:09 +0000 (14:26 +0200)
A SEGV could occur if a target did not return records and
no diagnostics.

src/filter_multi.cpp

index 4eb1988..ccefccf 100644 (file)
@@ -887,7 +887,7 @@ void yf::Multi::Frontend::present(mp::Package &package, Z_APDU *apdu_req)
             nprl->records[i] = (Z_NamePlusRecord*)
                 odr_malloc(odr, sizeof(Z_NamePlusRecord));
             int inside_pos = jit->m_pos - jit->m_start;
-            if (inside_pos >= b_resp->records->
+            if (!b_resp->records || inside_pos >= b_resp->records->
                 u.databaseOrSurDiagnostics->num_records)
                 break;
            *nprl->records[i] = *b_resp->records->