Let's say the current buffer contents (from lower to higher addresses) is abcdef, and you have a match at d of length 8. The end result is abcdefdefdefde.
This is common, as this way the encoder only needs to have the first repeating sequence in the buffer, and it can be repeated any number of times.
This does need some care to handle correctly, because the standard C library does not have a function to do this; it is the opposite of memmove() with respect to memcpy(), and I like to call it memrepeat(). If you use an open-coded loop to fill/emit the data, there is no problem (and no special handling is needed), because the destination-source delta stays constant.