mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-19 03:07:59 +00:00
Hoping to avoid a crash in OSX for a problem blitzrage found
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89051 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -264,13 +264,17 @@ int ast_expr(char *expr, char *buf, int length, struct ast_channel *chan)
|
|||||||
res_length = snprintf(buf, length, FP___PRINTF, io.val->u.i);
|
res_length = snprintf(buf, length, FP___PRINTF, io.val->u.i);
|
||||||
return_value = (res_length <= length) ? res_length : length;
|
return_value = (res_length <= length) ? res_length : length;
|
||||||
} else {
|
} else {
|
||||||
|
if (io.val->u.s)
|
||||||
#if defined(STANDALONE) || defined(LOW_MEMORY) || defined(STANDALONE_AEL)
|
#if defined(STANDALONE) || defined(LOW_MEMORY) || defined(STANDALONE_AEL)
|
||||||
strncpy(buf, io.val->u.s, length - 1);
|
strncpy(buf, io.val->u.s, length - 1);
|
||||||
#else /* !STANDALONE && !LOW_MEMORY */
|
#else /* !STANDALONE && !LOW_MEMORY */
|
||||||
ast_copy_string(buf, io.val->u.s, length);
|
ast_copy_string(buf, io.val->u.s, length);
|
||||||
#endif /* STANDALONE || LOW_MEMORY */
|
#endif /* STANDALONE || LOW_MEMORY */
|
||||||
|
else
|
||||||
|
buf[0] = 0;
|
||||||
return_value = strlen(buf);
|
return_value = strlen(buf);
|
||||||
free(io.val->u.s);
|
if (io.val->u.s)
|
||||||
|
free(io.val->u.s);
|
||||||
}
|
}
|
||||||
free(io.val);
|
free(io.val);
|
||||||
}
|
}
|
||||||
|
@@ -3207,13 +3207,17 @@ int ast_expr(char *expr, char *buf, int length, struct ast_channel *chan)
|
|||||||
res_length = snprintf(buf, length, FP___PRINTF, io.val->u.i);
|
res_length = snprintf(buf, length, FP___PRINTF, io.val->u.i);
|
||||||
return_value = (res_length <= length) ? res_length : length;
|
return_value = (res_length <= length) ? res_length : length;
|
||||||
} else {
|
} else {
|
||||||
|
if (io.val->u.s)
|
||||||
#if defined(STANDALONE) || defined(LOW_MEMORY) || defined(STANDALONE_AEL)
|
#if defined(STANDALONE) || defined(LOW_MEMORY) || defined(STANDALONE_AEL)
|
||||||
strncpy(buf, io.val->u.s, length - 1);
|
strncpy(buf, io.val->u.s, length - 1);
|
||||||
#else /* !STANDALONE && !LOW_MEMORY */
|
#else /* !STANDALONE && !LOW_MEMORY */
|
||||||
ast_copy_string(buf, io.val->u.s, length);
|
ast_copy_string(buf, io.val->u.s, length);
|
||||||
#endif /* STANDALONE || LOW_MEMORY */
|
#endif /* STANDALONE || LOW_MEMORY */
|
||||||
|
else
|
||||||
|
buf[0] = 0;
|
||||||
return_value = strlen(buf);
|
return_value = strlen(buf);
|
||||||
free(io.val->u.s);
|
if (io.val->u.s)
|
||||||
|
free(io.val->u.s);
|
||||||
}
|
}
|
||||||
free(io.val);
|
free(io.val);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user