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

Scott Griepentrog reviewboard at asterisk.org
Thu Jan 2 14:25:45 CST 2014


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

(Updated Jan. 2, 2014, 2:25 p.m.)


Status
------

This change has been marked as submitted.


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/20140102/c84e9339/attachment.html>


More information about the asterisk-dev mailing list