channel.c: remove strcpy & sprintf, and move to safe functions
channel.c: remove strcpy & sprintf, and move to safe functions

We used strcpy & sprintf in a few places, which opens up classic
buffer overflow issues, as described in:
https://cwe.mitre.org/data/definitions/120.html

This adds the recent length checking, to make sure as the buffer
descreases in size, it is managed properly. If we ever think we
run out of space, we will no longer buffer overflow.

Tested on Pluto and M2k to see if this introduces issues, and couldn't
find anything.

Signed-off-by: Robin Getz <c66e5a86ef9317cf35cecb2ed063996b2100ed4b@analog.com>

analogdevicesinc/libiio,analogdevicesinc/libiio,analogdevicesinc/libiio,analogdevicesinc/libiio