gets does not protect against buffer overflow, which is why its complaining.
Instead use
fgets(buffer,sizeof(buffer),stdin);
fgets will leave the end-of-line char on the of the buffer.
I always use this loop to remove it, this loop works on Windows and Linux.
The difference is that windows appends cr-lf and linux just lf.
Code:
char buffer[256];
char *p;
if (fgets(buffer,sizeof(buffer),stdin)) {
p=buffer+strlen(buffer);
while (p>buffer && *(p-1)<=' ') *(--p)='\0';
}