Doing a string replace
Few things to consider.

Why are you writing your own implementation of something that already exists, long history of reliable use with well defined behaviour (fun/assignment - sure, generally - waste of effort likely to lead to problems)?

What if input, from, or to are null, or not valid (not \0 terminated), OR overlap in any way (will it work)?

from and to, might imply to some people replace from here, to there.  Names are important - look for things that are self-evident.  Perhaps matchToReplace and replaceMatchWith - a bit wordy, but hopefully less ambiguous.

What happens if from is empty - what is the sensible result (document it)?

Don't you need to malloc one more than the desired length (for the terminating \0) [didn't read the algorithm carefully enough sorry].

Make sure you have test cases checking all the above, but also confirming that when you copy 0 length things, or 1 - that everything is copied properly.

Documenting - what tool are you using to publish it?  Certainly doesn't hurt to put a comment before - but remember what people are looking at is the headers - for the declaration, not the implementation (generally at least).