diff options
Diffstat (limited to 'io/hpmud')
-rw-r--r-- | io/hpmud/hpmud.c | 1 | ||||
-rw-r--r-- | io/hpmud/jd.c | 1 | ||||
-rw-r--r-- | io/hpmud/model.c | 2 | ||||
-rw-r--r-- | io/hpmud/musb.c | 2 | ||||
-rw-r--r-- | io/hpmud/pp.c | 2 |
5 files changed, 6 insertions, 2 deletions
diff --git a/io/hpmud/hpmud.c b/io/hpmud/hpmud.c index 0eb6fff3a..358f27999 100644 --- a/io/hpmud/hpmud.c +++ b/io/hpmud/hpmud.c @@ -759,6 +759,7 @@ enum HPMUD_RESULT hpmud_get_dstat(HPMUD_DEVICE dd, struct hpmud_dstat *ds) } strncpy(ds->uri, msp->device[dd].uri, sizeof(ds->uri)); + ds->uri[sizeof(ds->uri)-1] = '\0'; ds->io_mode = msp->device[dd].io_mode; ds->channel_cnt = msp->device[dd].channel_cnt; ds->mlc_up = msp->device[dd].mlc_up; diff --git a/io/hpmud/jd.c b/io/hpmud/jd.c index 06f5072ee..20df27ab0 100644 --- a/io/hpmud/jd.c +++ b/io/hpmud/jd.c @@ -31,6 +31,7 @@ #endif #include <signal.h> +#include <stdlib.h> #include "hpmud.h" #include "hpmudi.h" diff --git a/io/hpmud/model.c b/io/hpmud/model.c index 4ea89907d..a917d69fd 100644 --- a/io/hpmud/model.c +++ b/io/hpmud/model.c @@ -117,6 +117,7 @@ static int ReadConfig() if (rcbuf[0] == '[') { strncpy(section, rcbuf, sizeof(section)); /* found new section */ + section[sizeof(section)-1] = '\0'; continue; } @@ -125,6 +126,7 @@ static int ReadConfig() if ((strncasecmp(section, "[dirs]", 6) == 0) && (strcasecmp(key, "home") == 0)) { strncpy(homedir, value, sizeof(homedir)); + homedir[sizeof(homedir)-1] = '\0'; break; /* done */ } } diff --git a/io/hpmud/musb.c b/io/hpmud/musb.c index fe5d50f95..db6f3f55c 100644 --- a/io/hpmud/musb.c +++ b/io/hpmud/musb.c @@ -776,7 +776,7 @@ static int device_id(int fd, unsigned char *buffer, int size) len = size-1; /* leave byte for zero termination */ if (len > 2) len -= 2; - memcpy(buffer, buffer+2, len); /* remove length */ + memmove(buffer, buffer+2, len); /* remove length */ buffer[len]=0; DBG("read actual device_id successfully fd=%d len=%d\n", fd, len); diff --git a/io/hpmud/pp.c b/io/hpmud/pp.c index 74c5fdcb4..021d62743 100644 --- a/io/hpmud/pp.c +++ b/io/hpmud/pp.c @@ -632,7 +632,7 @@ static int device_id(int fd, char *buffer, int size) len = size-1; /* leave byte for zero termination */ if (len > 2) len -= 2; - memcpy(buffer, buffer+2, len); /* remove length */ + memmove(buffer, buffer+2, len); /* remove length */ buffer[len]=0; DBG("read actual device_id successfully fd=%d len=%d\n", fd, len); |