mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-01 19:43:03 +00:00
Handle negative length and eliminate a condition that is always true.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@177287 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -114,8 +114,10 @@ char *__ast_str_helper2(struct ast_str **buf, size_t maxlen, const char *src, si
|
||||
int dynamic = 0;
|
||||
char *ptr = append ? &((*buf)->__AST_STR_STR[(*buf)->__AST_STR_USED]) : (*buf)->__AST_STR_STR;
|
||||
|
||||
if (!maxlen) {
|
||||
dynamic = 1;
|
||||
if (maxlen < 1) {
|
||||
if (maxlen == 0) {
|
||||
dynamic = 1;
|
||||
}
|
||||
maxlen = (*buf)->__AST_STR_LEN;
|
||||
}
|
||||
|
||||
@@ -140,10 +142,7 @@ char *__ast_str_helper2(struct ast_str **buf, size_t maxlen, const char *src, si
|
||||
/* What we extended the buffer by */
|
||||
maxlen = old;
|
||||
|
||||
/* Update ptr, if necessary */
|
||||
if ((*buf)->__AST_STR_STR != oldbase) {
|
||||
ptr = ptr - oldbase + (*buf)->__AST_STR_STR;
|
||||
}
|
||||
ptr += (*buf)->__AST_STR_STR - oldbase;
|
||||
}
|
||||
}
|
||||
if (__builtin_expect(!(maxsrc && maxlen), 0)) {
|
||||
|
||||
Reference in New Issue
Block a user