X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=oggdec.c;h=46fb17ed5808e1c425ad6e9b2da178474f815d4a;hp=6b96c505c6cef18dd4b9ebf4e899f105c65f3e6f;hb=b779fcfc62bca2e728348c70bab3c50df3fe63b8;hpb=cb4dd13c2327c13d486b6abe572f4af2398b65de diff --git a/oggdec.c b/oggdec.c index 6b96c505..46fb17ed 100644 --- a/oggdec.c +++ b/oggdec.c @@ -163,13 +163,29 @@ static ssize_t ogg_convert(char *inbuffer, size_t len, struct filter_node *fn) return pod->converted; } -static void *oggdec_parse_config(int argc, char **argv) +static int oggdec_parse_config(int argc, char **argv, void **config) { - struct oggdec_filter_args_info *ret = para_calloc(sizeof(struct oggdec_filter_args_info)); - if (!oggdec_cmdline_parser(argc, argv, ret)) - return ret; - free(ret); - return NULL; + int ret; + struct oggdec_filter_args_info *ogg_conf; + + ogg_conf = para_calloc(sizeof(*ogg_conf)); + ret = -E_OGGDEC_SYNTAX; + if (oggdec_cmdline_parser(argc, argv, ogg_conf)) + goto err; + ret = -ERRNO_TO_PARA_ERROR(EINVAL); + if (ogg_conf->bufsize_arg < 0) + goto err; + if (ogg_conf->bufsize_arg >= INT_MAX / 1024) + goto err; + if (ogg_conf->initial_buffer_arg < 0) + goto err; + if (ogg_conf->initial_buffer_arg >= INT_MAX / 1024) + goto err; + *config = ogg_conf; + return 1; +err: + free(ogg_conf); + return ret; } /**