summaryrefslogtreecommitdiffstats
path: root/src/dabOutput
diff options
context:
space:
mode:
Diffstat (limited to 'src/dabOutput')
-rw-r--r--src/dabOutput/dabOutputRaw.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/dabOutput/dabOutputRaw.cpp b/src/dabOutput/dabOutputRaw.cpp
index 42248c5..edd1dd7 100644
--- a/src/dabOutput/dabOutputRaw.cpp
+++ b/src/dabOutput/dabOutputRaw.cpp
@@ -206,7 +206,9 @@ int DabOutputRaw::Open(const char* name)
struct ifreq ifr;
struct sockaddr_ll saddr;
memset(&ifr, 0, sizeof(struct ifreq));
- (void)strncpy(ifr.ifr_name, filename, sizeof(ifr.ifr_name));
+ if (sizeof(ifr.ifr_name) > 0) {
+ strncpy(ifr.ifr_name, filename, sizeof(ifr.ifr_name) - 1);
+ }
// Get current Farsync configuration
struct fstioc_info info;
@@ -363,7 +365,10 @@ int DabOutputRaw::Open(const char* name)
// ioctl to read the interface number
memset(&ifr, 0, sizeof(struct ifreq));
- strncpy(ifr.ifr_name, filename, sizeof(ifr.ifr_name));
+ if (sizeof(ifr.ifr_name) > 0) {
+ strncpy(ifr.ifr_name, filename, sizeof(ifr.ifr_name) - 1);
+ }
+
if (ioctl(socket_, SIOCGIFINDEX, (char *) &ifr) == -1) {
perror(filename);
return -1;