Commit 35632b67 authored by Niels Möller's avatar Niels Möller

* tools/sexp-conv.c (sexp_get_token_string): Fixed end of file

handling.
(sexp_get_string): Fixed end of encoding/end of file handling.
(parse_options): Check for negative width and complain.

Rev: src/nettle/tools/sexp-conv.c:1.3
parent 8ada538c
......@@ -302,7 +302,7 @@ sexp_get_token_string(struct sexp_input *input)
sexp_push_char(input);
sexp_get_char(input);
}
while (TOKEN_CHAR(input->c));
while (input->ctype == SEXP_NORMAL_CHAR && TOKEN_CHAR(input->c));
assert (input->string.size);
}
......@@ -459,7 +459,7 @@ sexp_get_token(struct sexp_input *input, enum sexp_mode mode)
case SEXP_END_CHAR:
input->token = SEXP_CODING_END;
sexp_input_end_coding(input);
sexp_next_char(input);
sexp_get_char(input);
return;
case SEXP_NORMAL_CHAR:
......@@ -1022,10 +1022,11 @@ parse_options(struct conv_options *o,
case 'w':
{
char *end;
o->width = strtol(optarg, &end , 0);
if (!*optarg || *end || o->width < 0)
die("sexp-conv: Invalid width `%s'.\n",
optarg);
int width = strtol(optarg, &end , 0);
if (!*optarg || *end || width < 0)
die("sexp-conv: Invalid width `%s'.\n", optarg);
o->width = width;
break;
}
case 's':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment