[asterisk-dev] [Code Review] 3083: funcs: REPLACE() can call strcpy on overlapping memory

Scott Griepentrog reviewboard at asterisk.org
Thu Dec 19 14:02:38 CST 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3083/
-----------------------------------------------------------

Review request for Asterisk Developers.


Bugs: ASTERISK-22910
    https://issues.asterisk.org/jira/browse/ASTERISK-22910


Repository: Asterisk


Description
-------

Patch by: Gareth Palmer

When calling REPLACE() with an empty replace-char argument; strcpy is used to overwrite the the matching <find-char>.

However as the src and dest argument to strcpy must not overlap it causes other parts of the string to be overwritten with adjacent characters and the result is mangled.

Patch replaces call to strcpy with memmove and adds a test suite case for REPLACE.


Diffs
-----

  /branches/1.8/funcs/func_strings.c 404386 

Diff: https://reviewboard.asterisk.org/r/3083/diff/


Testing
-------


Thanks,

Scott Griepentrog

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20131219/5480b87b/attachment.html>


More information about the asterisk-dev mailing list