Skip to content
Snippets Groups Projects
Commit e4c22cea authored by Kevin P. Fleming's avatar Kevin P. Fleming
Browse files

don't let ast_trim_blanks operate on empty strings or run off the beginning of the string

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5929 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 3b726869
Branches
Tags
No related merge requests found
...@@ -46,13 +46,15 @@ char *ast_skip_blanks(char *str) ...@@ -46,13 +46,15 @@ char *ast_skip_blanks(char *str)
char *ast_trim_blanks(char *str) char *ast_trim_blanks(char *str)
{ {
if (str) { char *work = str;
str += strlen(str) - 1;
while (*str && *str < 33) if (work && !ast_strlen_zero(work)) {
str--; work += strlen(work) - 1;
*(++str) = '\0'; /* terminate string */ while ((work >= str) && *work && *work < 33)
work--;
*(++work) = '\0'; /* terminate string */
} }
return str; return work;
} }
char *ast_skip_nonblanks(char *str) char *ast_skip_nonblanks(char *str)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment