Merged revisions 298054 via svnmerge from
authorMatthew Nicholson <mnicholson@digium.com>
Fri, 10 Dec 2010 16:53:43 +0000 (16:53 +0000)
committerMatthew Nicholson <mnicholson@digium.com>
Fri, 10 Dec 2010 16:53:43 +0000 (16:53 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r298054 | mnicholson | 2010-12-10 10:52:11 -0600 (Fri, 10 Dec 2010) | 2 lines

  Prevent a memcpy overlap in GENERIC_FAX_EXEC_SET_VARS
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@298055 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_fax.c

index bfd4a51..716cbee 100644 (file)
@@ -928,9 +928,12 @@ static void set_channel_variables(struct ast_channel *chan, struct ast_fax_sessi
 
 #define GENERIC_FAX_EXEC_SET_VARS(fax, chan, errorstr, reason) \
        do {    \
-               ast_string_field_set(fax->details, result, S_OR(fax->details->result, "FAILED")); \
-               ast_string_field_set(fax->details, resultstr, S_OR(fax->details->resultstr, reason)); \
-               ast_string_field_set(fax->details, error, S_OR(fax->details->error, errorstr)); \
+               if (ast_strlen_zero(fax->details->result)) \
+                       ast_string_field_set(fax->details, result, "FAILED"); \
+               if (ast_strlen_zero(fax->details->resultstr)) \
+                       ast_string_field_set(fax->details, resultstr, reason); \
+               if (ast_strlen_zero(fax->details->error)) \
+                       ast_string_field_set(fax->details, error, errorstr); \
                set_channel_variables(chan, fax->details); \
        } while (0)