diff options
author | wm4 <wm4@nowhere> | 2014-11-17 21:24:52 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-11-17 21:24:52 +0100 |
commit | 1b2795913a99e5df799b272528dcf57e8d6fce3f (patch) | |
tree | a990abb094d346ecab018a01aa3e2476db41c917 /libass/ass_parse.c | |
parent | 2f9467cfd2574af44f97ee89b460c410a5a3c85a (diff) | |
download | libass-1b2795913a99e5df799b272528dcf57e8d6fce3f.tar.bz2 libass-1b2795913a99e5df799b272528dcf57e8d6fce3f.tar.xz |
More malloc checking
Use strndup() instead of malloc+copy.
Make all code deal with the possibility that ASS_Drawing.text can be
NULL (which can happen on allocation failure).
Skip fix_collisions() on malloc failure - the lines will overlap, but at
least libass won't crash.
Diffstat (limited to 'libass/ass_parse.c')
-rw-r--r-- | libass/ass_parse.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/libass/ass_parse.c b/libass/ass_parse.c index 7a17b80..641d42c 100644 --- a/libass/ass_parse.c +++ b/libass/ass_parse.c @@ -538,9 +538,7 @@ char *parse_tag(ASS_Renderer *render_priv, char *p, char *end, double pwr) end = args->end; if (nargs && strncmp(start, "0", end - start)) { skip_spaces(&start); - family = malloc(end - start + 1); - strncpy(family, start, end - start); - family[end - start] = '\0'; + family = strndup(start, end - start); } else family = strdup(render_priv->state.style->FontName); free(render_priv->state.family); |