fix breakage when ast_copy_string is used to copy substrings (bug #4146, but a different fix)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5561 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2005-05-03 23:51:20 +00:00
parent 09ed70fcaf
commit 50b9f0e970
2 changed files with 25 additions and 26 deletions

View File

@@ -420,8 +420,10 @@ int ast_wait_for_input(int fd, int ms)
void ast_copy_string(char *dst, const char *src, size_t size)
{
while (*src && size--)
while (*src && size) {
*dst++ = *src++;
size--;
}
if (__builtin_expect(!size, 0))
dst--;
*dst = '\0';