diff options
Diffstat (limited to 'apps/plugins/zxbox')
-rw-r--r-- | apps/plugins/zxbox/snapshot.c | 6 | ||||
-rw-r--r-- | apps/plugins/zxbox/spconf.c | 3 | ||||
-rw-r--r-- | apps/plugins/zxbox/sptape.c | 3 | ||||
-rw-r--r-- | apps/plugins/zxbox/tapefile.c | 6 |
4 files changed, 6 insertions, 12 deletions
diff --git a/apps/plugins/zxbox/snapshot.c b/apps/plugins/zxbox/snapshot.c index d078ec78b1..9a68540a04 100644 --- a/apps/plugins/zxbox/snapshot.c +++ b/apps/plugins/zxbox/snapshot.c @@ -603,8 +603,7 @@ void save_snapshot_file(char *name) { int type; - rb->strncpy(filenamebuf, name, MAXFILENAME-10); - filenamebuf[MAXFILENAME-10] = '\0'; + rb->strlcpy(filenamebuf, name, MAXFILENAME-10 + 1); type = SN_Z80; if(check_ext(filenamebuf, "z80")) type = SN_Z80; @@ -642,8 +641,7 @@ void load_snapshot_file_type(char *name, int type) int snsh; SNFILE snfil; - rb->strncpy(filenamebuf, name, MAXFILENAME-10); - filenamebuf[MAXFILENAME-10] = '\0'; + rb->strlcpy(filenamebuf, name, MAXFILENAME-10 + 1); spcf_find_file_type(filenamebuf, &filetype, &type); if(type < 0) type = SN_Z80; diff --git a/apps/plugins/zxbox/spconf.c b/apps/plugins/zxbox/spconf.c index 5a14959adc..728f78638c 100644 --- a/apps/plugins/zxbox/spconf.c +++ b/apps/plugins/zxbox/spconf.c @@ -111,8 +111,7 @@ void spcf_read_command_line(const void* parameter) file_type = extensions[ix].type; file_subtype = extensions[ix].subtype; - rb->strncpy(filenamebuf, parameter, MAXFILENAME - 10); - filenamebuf[MAXFILENAME-10] = '\0'; + rb->strlcpy(filenamebuf, parameter, MAXFILENAME - 10 + 1); if(file_type < 0) file_subtype = -1; if(!spcf_find_file_type(filenamebuf, &file_type, &file_subtype)) return; diff --git a/apps/plugins/zxbox/sptape.c b/apps/plugins/zxbox/sptape.c index f0e04de2fb..21f962ea28 100644 --- a/apps/plugins/zxbox/sptape.c +++ b/apps/plugins/zxbox/sptape.c @@ -594,8 +594,7 @@ void start_play_file_type(char *name, int seg, int type) { int filetype = FT_TAPEFILE; - rb->strncpy(tapename, name, MAXFILENAME-10); - tapename[MAXFILENAME-10] = '\0'; + rb->strlcpy(tapename, name, MAXFILENAME-10 + 1); currseg = seg; tapetype = type; diff --git a/apps/plugins/zxbox/tapefile.c b/apps/plugins/zxbox/tapefile.c index 19f6aba980..0e262aa0f7 100644 --- a/apps/plugins/zxbox/tapefile.c +++ b/apps/plugins/zxbox/tapefile.c @@ -510,8 +510,7 @@ static int interpret_tzx_header(byte *hb, struct seginfo *csp) int blen; rb->snprintf(seg_desc,DESC_LEN, "Begin Group: "); blen = (int) rb->strlen(seg_desc); - rb->strncpy(seg_desc+blen, (char *) rbuf, (unsigned) csp->len); - seg_desc[csp->len + blen] = '\0'; + rb->strlcpy(seg_desc+blen, (char *) rbuf, (unsigned) csp->len + 1); } break; @@ -618,8 +617,7 @@ static int interpret_tzx_header(byte *hb, struct seginfo *csp) return 0; } csp->ptr += csp->len; - rb->strncpy(seg_desc, (char *) rbuf, (unsigned) csp->len); - seg_desc[csp->len] = '\0'; + rb->strlcpy(seg_desc, (char *) rbuf, (unsigned) csp->len + 1); break; case 0x32: |