projects
/
yaz-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bb376bb
)
Ensure format command is a no-op if bad syntax is passed to it.
author
Adam Dickmeiss
<adam@indexdata.dk>
Wed, 24 Sep 2008 18:19:37 +0000
(20:19 +0200)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Wed, 24 Sep 2008 18:19:37 +0000
(20:19 +0200)
client/client.c
patch
|
blob
|
history
diff --git
a/client/client.c
b/client/client.c
index
c34d201
..
106f12d
100644
(file)
--- a/
client/client.c
+++ b/
client/client.c
@@
-3267,23
+3267,29
@@
int cmd_format(const char *arg)
printf("Usage: format <recordsyntax>\n");
return 0;
}
printf("Usage: format <recordsyntax>\n");
return 0;
}
+ while (sscanf(cp, "%40s%n", form_str, &nor) >= 1 && nor > 0
+ && idx < RECORDSYNTAX_MAX)
+ {
+ if (strcmp(form_str, "none") &&
+ !yaz_string_to_oid_odr(yaz_oid_std(), CLASS_RECSYN, form_str, out))
+ {
+ printf("Bad format: %s\n", form_str);
+ return 0;
+ }
+ cp += nor;
+ }
for (i = 0; i < recordsyntax_size; i++)
{
xfree(recordsyntax_list[i]);
recordsyntax_list[i] = 0;
}
for (i = 0; i < recordsyntax_size; i++)
{
xfree(recordsyntax_list[i]);
recordsyntax_list[i] = 0;
}
-
+
+ cp = arg;
while (sscanf(cp, "%40s%n", form_str, &nor) >= 1 && nor > 0
&& idx < RECORDSYNTAX_MAX)
{
if (!strcmp(form_str, "none"))
break;
while (sscanf(cp, "%40s%n", form_str, &nor) >= 1 && nor > 0
&& idx < RECORDSYNTAX_MAX)
{
if (!strcmp(form_str, "none"))
break;
- if (!yaz_string_to_oid_odr(yaz_oid_std(), CLASS_RECSYN, form_str, out))
- {
- printf("Bad format: %s\n", form_str);
- recordsyntax_size = 0;
- return 0;
- }
recordsyntax_list[idx] = xstrdup(form_str);
cp += nor;
idx++;
recordsyntax_list[idx] = xstrdup(form_str);
cp += nor;
idx++;