Background:
I have a small routine that mimics fgets(character, 2, fp)
except it takes a character from a string instead of a stream. newBuff is dynamically allocated string passed as a parameter and character is declared as char character[2]
.
Routine:
character[0] = newBuff[0];
character[1] = '\0';
strcpy(newBuff, newBuff+1);
The strcpy replicates the loss of information as each character is read from it.
Problem: Valgrind does warns me about this activity, "Source and destination overlap in strcpy(0x419b818, 0x419b819)".
Should I worry about this warning?
strcpy
highly unsafe and likely to break even between different versions of the same library, or even different builds with different compilers. – Agonizing