[Home]

Summary:ASTERISK-22910: [patch] - REPLACE() calls strcpy on overlapping memory when <replace-char> is empty
Reporter:Gareth Palmer (gareth)Labels:
Date Opened:2013-11-25 19:10:56.000-0600Date Closed:2014-01-02 13:39:03.000-0600
Priority:MinorRegression?
Status:Closed/CompleteComponents:Functions/func_strings
Versions:11.6.0 12.0.0-beta2 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:( 0) func_strings.patch
Description: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.
Comments:By: Matt Jordan (mjordan) 2013-11-26 12:05:43.306-0600

With a unit test! Fantastic!