Fix potential buffer overrun that could occur if SRU charset name
[yaz-moved-to-github.git] / ztest / ztest.c
index 5769d52..67a4f06 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: ztest.c,v 1.88 2007-04-16 21:53:09 adam Exp $
+ * $Id: ztest.c,v 1.92 2007-05-30 08:04:28 adam Exp $
  */
 
 /*
@@ -40,14 +40,6 @@ int ztest_search(void *handle, bend_search_rr *rr)
         rr->errcode = 23;
         return 0;
     }
-#if NMEM_DEBUG
-    /* if database is stop, stop this process.. For debugging only. */
-    if (!yaz_matchstr (rr->basenames[0], "stop"))
-    {
-        nmem_print_list_l(YLOG_LOG);
-        exit(0);
-    }
-#endif
     /* Throw Database unavailable if other than Default or Slow */
     if (!yaz_matchstr (rr->basenames[0], "Default"))
         ;  /* Default is OK in our test */
@@ -138,7 +130,7 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr)
                 if (r->direct_reference)
                 {
                     char oid_name_str[OID_STR_MAX];
-                    int oclass;
+                    oid_class oclass;
                     const char *oid_name = 
                         yaz_oid_to_string_buf(r->direct_reference,
                                           &oclass, oid_name_str);
@@ -460,10 +452,10 @@ int ztest_present (void *handle, bend_present_rr *rr)
 int ztest_fetch(void *handle, bend_fetch_rr *r)
 {
     char *cp;
-    int oclass;
+    oid_class oclass;
     char oid_str_buf[OID_STR_MAX];
     const char *oid_str = 0;
-    const int *oid = r->request_format;
+    const Odr_oid *oid = r->request_format;
 
     r->last_in_set = 0;
     r->basename = "Default";
@@ -721,6 +713,9 @@ bend_initresult *bend_init(bend_initrequest *q)
     q->bend_srw_scan = ztest_scan;
     q->bend_srw_update = ztest_update;
 
+    q->query_charset = "ISO-8859-1";
+    q->records_in_same_charset = 0;
+
     return r;
 }