projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
configure produces config.h
[idzebra-moved-to-github.git]
/
data1
/
d1_expout.c
diff --git
a/data1/d1_expout.c
b/data1/d1_expout.c
index
b740444
..
9b82aa7
100644
(file)
--- a/
data1/d1_expout.c
+++ b/
data1/d1_expout.c
@@
-1,5
+1,5
@@
/* This file is part of the Zebra server.
/* This file is part of the Zebra server.
- Copyright (C) 1994-2010 Index Data
+ Copyright (C) 1994-2011 Index Data
Zebra is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Zebra is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
@@
-21,6
+21,9
@@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* This module converts data1 tree to Z39.50 Explain records
*/
* This module converts data1 tree to Z39.50 Explain records
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
@@
-68,18
+71,15
@@
static int is_data_tag (ExpHandle *eh, data1_node *c)
return 1;
}
return 1;
}
-static int *f_integer(ExpHandle *eh, data1_node *c)
+static Odr_int *f_integer(ExpHandle *eh, data1_node *c)
{
{
- int *r;
char intbuf[64];
c = c->child;
char intbuf[64];
c = c->child;
- if (!is_data_tag (eh, c) || c->u.data.len > 63)
+ if (!is_data_tag (eh, c) || c->u.data.len >= sizeof(intbuf))
return 0;
return 0;
- r = (int *)odr_malloc(eh->o, sizeof(*r));
sprintf(intbuf, "%.*s", c->u.data.len, c->u.data.data);
sprintf(intbuf, "%.*s", c->u.data.len, c->u.data.data);
- *r = atoi(intbuf);
- return r;
+ return odr_intdup(eh->o, atoi(intbuf));
}
static char *f_string(ExpHandle *eh, data1_node *c)
}
static char *f_string(ExpHandle *eh, data1_node *c)
@@
-251,7
+251,7
@@
Z_RpnCapabilities *f_rpnCapabilities (ExpHandle *eh, data1_node *n)
(res->num_operators)++;
}
if (res->num_operators)
(res->num_operators)++;
}
if (res->num_operators)
- res->operators = (int **)
+ res->operators = (Odr_int **)
odr_malloc (eh->o, res->num_operators
* sizeof(*res->operators));
for (n = c->child; n; n = n->next)
odr_malloc (eh->o, res->num_operators
* sizeof(*res->operators));
for (n = c->child; n; n = n->next)
@@
-388,9
+388,8
@@
static Z_AccessInfo *f_accessInfo(ExpHandle *eh, data1_node *n)
return res;
}
return res;
}
-static int *f_recordCount(ExpHandle *eh, data1_node *c, int *which)
+static Odr_int *f_recordCount(ExpHandle *eh, data1_node *c, int *which)
{
{
- int *r= (int *)odr_malloc(eh->o, sizeof(*r));
int *wp = which;
char intbuf[64];
int *wp = which;
char intbuf[64];
@@
-403,11
+402,11
@@
static int *f_recordCount(ExpHandle *eh, data1_node *c, int *which)
*wp = Z_DatabaseInfo_approxNumber;
else
return 0;
*wp = Z_DatabaseInfo_approxNumber;
else
return 0;
- if (!c->child || c->child->which != DATA1N_data)
+ if (!c->child || c->child->which != DATA1N_data ||
+ c->child->u.data.len >= sizeof(intbuf))
return 0;
sprintf(intbuf, "%.*s", c->child->u.data.len, c->child->u.data.data);
return 0;
sprintf(intbuf, "%.*s", c->child->u.data.len, c->child->u.data.data);
- *r = atoi(intbuf);
- return r;
+ return odr_intdup(eh->o, atoi(intbuf));
}
static Z_ContactInfo *f_contactInfo(ExpHandle *eh, data1_node *n)
}
static Z_ContactInfo *f_contactInfo(ExpHandle *eh, data1_node *n)