diff options
Diffstat (limited to 'apps/plugins/properties.c')
-rw-r--r-- | apps/plugins/properties.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c index 18beec2da6..b57150b817 100644 --- a/apps/plugins/properties.c +++ b/apps/plugins/properties.c | |||
@@ -70,8 +70,7 @@ static bool file_properties(char* selected_file) | |||
70 | 70 | ||
71 | char* ptr = rb->strrchr(selected_file, '/') + 1; | 71 | char* ptr = rb->strrchr(selected_file, '/') + 1; |
72 | int dirlen = (ptr - selected_file); | 72 | int dirlen = (ptr - selected_file); |
73 | rb->strncpy(tstr, selected_file, dirlen); | 73 | rb->strlcpy(tstr, selected_file, dirlen + 1); |
74 | tstr[dirlen] = 0; | ||
75 | 74 | ||
76 | dir = rb->opendir(tstr); | 75 | dir = rb->opendir(tstr); |
77 | if (dir) | 76 | if (dir) |
@@ -212,7 +211,7 @@ static bool dir_properties(char* selected_file) | |||
212 | { | 211 | { |
213 | DPS dps; | 212 | DPS dps; |
214 | char tstr[64]; | 213 | char tstr[64]; |
215 | rb->strncpy(dps.dirname, selected_file, MAX_PATH); | 214 | rb->strlcpy(dps.dirname, selected_file, MAX_PATH); |
216 | dps.len = MAX_PATH; | 215 | dps.len = MAX_PATH; |
217 | dps.dc = 0; | 216 | dps.dc = 0; |
218 | dps.fc = 0; | 217 | dps.fc = 0; |
@@ -220,7 +219,7 @@ static bool dir_properties(char* selected_file) | |||
220 | if(false == _dir_properties(&dps)) | 219 | if(false == _dir_properties(&dps)) |
221 | return false; | 220 | return false; |
222 | 221 | ||
223 | rb->strncpy(str_dirname, selected_file, MAX_PATH); | 222 | rb->strlcpy(str_dirname, selected_file, MAX_PATH); |
224 | rb->snprintf(str_dircount, sizeof str_dircount, "Subdirs: %d", dps.dc); | 223 | rb->snprintf(str_dircount, sizeof str_dircount, "Subdirs: %d", dps.dc); |
225 | rb->snprintf(str_filecount, sizeof str_filecount, "Files: %d", dps.fc); | 224 | rb->snprintf(str_filecount, sizeof str_filecount, "Files: %d", dps.fc); |
226 | rb->snprintf(str_size, sizeof str_size, "Size: %s", | 225 | rb->snprintf(str_size, sizeof str_size, "Size: %s", |
@@ -236,35 +235,35 @@ char * get_props(int selected_item, void* data, char *buffer, size_t buffer_len) | |||
236 | switch(selected_item) | 235 | switch(selected_item) |
237 | { | 236 | { |
238 | case 0: | 237 | case 0: |
239 | rb->strncpy(buffer, str_dirname, buffer_len); | 238 | rb->strlcpy(buffer, str_dirname, buffer_len); |
240 | break; | 239 | break; |
241 | case 1: | 240 | case 1: |
242 | rb->strncpy(buffer, its_a_dir ? str_dircount : str_filename, | 241 | rb->strlcpy(buffer, its_a_dir ? str_dircount : str_filename, |
243 | buffer_len); | 242 | buffer_len); |
244 | break; | 243 | break; |
245 | case 2: | 244 | case 2: |
246 | rb->strncpy(buffer, its_a_dir ? str_filecount : str_size, buffer_len); | 245 | rb->strlcpy(buffer, its_a_dir ? str_filecount : str_size, buffer_len); |
247 | break; | 246 | break; |
248 | case 3: | 247 | case 3: |
249 | rb->strncpy(buffer, its_a_dir ? str_size : str_date, buffer_len); | 248 | rb->strlcpy(buffer, its_a_dir ? str_size : str_date, buffer_len); |
250 | break; | 249 | break; |
251 | case 4: | 250 | case 4: |
252 | rb->strncpy(buffer, its_a_dir ? "" : str_time, buffer_len); | 251 | rb->strlcpy(buffer, its_a_dir ? "" : str_time, buffer_len); |
253 | break; | 252 | break; |
254 | case 5: | 253 | case 5: |
255 | rb->strncpy(buffer, its_a_dir ? "" : str_artist, buffer_len); | 254 | rb->strlcpy(buffer, its_a_dir ? "" : str_artist, buffer_len); |
256 | break; | 255 | break; |
257 | case 6: | 256 | case 6: |
258 | rb->strncpy(buffer, its_a_dir ? "" : str_title, buffer_len); | 257 | rb->strlcpy(buffer, its_a_dir ? "" : str_title, buffer_len); |
259 | break; | 258 | break; |
260 | case 7: | 259 | case 7: |
261 | rb->strncpy(buffer, its_a_dir ? "" : str_album, buffer_len); | 260 | rb->strlcpy(buffer, its_a_dir ? "" : str_album, buffer_len); |
262 | break; | 261 | break; |
263 | case 8: | 262 | case 8: |
264 | rb->strncpy(buffer, its_a_dir ? "" : str_duration, buffer_len); | 263 | rb->strlcpy(buffer, its_a_dir ? "" : str_duration, buffer_len); |
265 | break; | 264 | break; |
266 | default: | 265 | default: |
267 | rb->strncpy(buffer, "ERROR", buffer_len); | 266 | rb->strlcpy(buffer, "ERROR", buffer_len); |
268 | break; | 267 | break; |
269 | } | 268 | } |
270 | return buffer; | 269 | return buffer; |
@@ -284,8 +283,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
284 | struct dirent* entry; | 283 | struct dirent* entry; |
285 | char* ptr = rb->strrchr(file, '/') + 1; | 284 | char* ptr = rb->strrchr(file, '/') + 1; |
286 | int dirlen = (ptr - file); | 285 | int dirlen = (ptr - file); |
287 | rb->strncpy(str_dirname, file, dirlen); | 286 | rb->strlcpy(str_dirname, file, dirlen + 1); |
288 | str_dirname[dirlen] = 0; | ||
289 | 287 | ||
290 | dir = rb->opendir(str_dirname); | 288 | dir = rb->opendir(str_dirname); |
291 | if (dir) | 289 | if (dir) |