From: Lars Magne Ingebrigtsen Date: Tue, 13 Aug 2013 18:22:04 +0000 (+0200) Subject: * image.c (imagemagick_filename_hint): Check for errors in the alist structure. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1686^2~269 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=66e7901a78f6186dec959d08a85d71a87d3b940f;p=emacs.git * image.c (imagemagick_filename_hint): Check for errors in the alist structure. --- diff --git a/src/ChangeLog b/src/ChangeLog index 6d2c5722bdf..af76a0c3780 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-08-13 Lars Magne Ingebrigtsen + + * image.c (imagemagick_filename_hint): Check for errors in the + alist structure. + 2013-08-13 Eli Zaretskii * window.c (Fwindow_margins): Return nil when there's no marginal diff --git a/src/image.c b/src/image.c index 35cbbb631ae..3d2b325ded9 100644 --- a/src/image.c +++ b/src/image.c @@ -7853,19 +7853,27 @@ imagemagick_filename_hint (Lisp_Object spec) { Lisp_Object content_type = image_spec_value (spec, QCcontent_type, NULL); Lisp_Object symbol = intern ("image-content-type-suffixes"); - Lisp_Object suffix; + Lisp_Object val; char *name, *prefix = "/tmp/foo."; if (NILP (Fboundp (symbol))) return NULL; - suffix = Fcar (Fcdr (Fassq (content_type, Fsymbol_value (symbol)))); - if (! STRINGP (suffix)) + val = Fassq (content_type, Fsymbol_value (symbol)); + if (! CONSP (val)) return NULL; - name = xmalloc (strlen (prefix) + SBYTES (suffix) + 1); + val = Fcdr (val); + if (! CONSP (val)) + return NULL; + + val = Fcar (val); + if (! STRINGP (val)) + return NULL; + + name = xmalloc (strlen (prefix) + SBYTES (val) + 1); strcpy(name, prefix); - strcat(name, SDATA (suffix)); + strcat(name, SDATA (val)); return name; }