Instead of strncpy(), you could use snprintf(buffer, BUFFER_SIZE, "%s", src); Here's a one-liner which copies at most size-1 non-null characters from src to dest and adds a null terminator: static inline void cpystr(char *dest, const char *src, size_t size) { if(size) while...
{fprintf(stderr,"Could not get MAC address for interface %s: %s\n", ifreq_c.ifr_name, strerror(errno));exit(EXIT_FAILURE); }#else#error"Not yet implemented."#endif// Get IF assigned IP Address.strncpy(ifreq_ip.ifr_name, ifreq_c.ifr_name, IFNAMSIZ -1);#ifdefined(SIOCGIFADDR)if(io...