Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/utils.c @ 2119:3b26f3a58cb9
Fix command line issue reported by Minos
Fix small memory corruption in strip_arg_special_chars().
strcpy() cannot be used there because the areas overlap.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Tue, 24 Jun 2014 18:56:24 +0200 |
parents | 9023a6f2bf6c |
children | 69d00a118c0c |
comparison
equal
deleted
inserted
replaced
2118:51fde9c25401 | 2119:3b26f3a58cb9 |
---|---|
587 | 587 |
588 for (p = s; *p; p++) { | 588 for (p = s; *p; p++) { |
589 if (*p == '"') { | 589 if (*p == '"') { |
590 if (!escape) { | 590 if (!escape) { |
591 instring = !instring; | 591 instring = !instring; |
592 strcpy(p, p+1); | 592 //memmove(p, p+1, strlen(p)); |
593 for (char *t=p; *t; t++) | |
594 *t = *(t+1); | |
593 p--; | 595 p--; |
594 } else | 596 } else |
595 escape = FALSE; | 597 escape = FALSE; |
596 } else if (*p == '\\') { | 598 } else if (*p == '\\') { |
597 if (!escape) { | 599 if (!escape) { |
598 strcpy(p, p+1); | 600 //memmove(p, p+1, strlen(p)); |
601 for (char *t=p; *t; t++) | |
602 *t = *(t+1); | |
599 p--; | 603 p--; |
600 } | 604 } |
601 escape = !escape; | 605 escape = !escape; |
602 } else | 606 } else |
603 escape = FALSE; | 607 escape = FALSE; |