diff options
author | William Wilgus <wilgus.william@gmail.com> | 2022-11-15 00:29:35 -0500 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2022-11-15 01:24:26 -0500 |
commit | 687767bd8f4f471c2c6e9509125a78d7cb5f0f62 (patch) | |
tree | e76f7412eafeeecd73445149c60651b31d56d8bf | |
parent | aea324b74661e77341e518de981fc989ffd1e010 (diff) | |
download | rockbox-687767bd8f4f471c2c6e9509125a78d7cb5f0f62.tar.gz rockbox-687767bd8f4f471c2c6e9509125a78d7cb5f0f62.zip |
convert a few more strlcpy to strmemccpy calls Fix Red and Yellow
albumart is imported to plugins just use a macro substitution
for now
Change-Id: I7c2e10d7559c087f0b3d0e6b844027d3b323da55
-rw-r--r-- | apps/iap/iap-lingo4.c | 2 | ||||
-rw-r--r-- | apps/onplay.c | 6 | ||||
-rw-r--r-- | apps/playlist.c | 2 | ||||
-rw-r--r-- | apps/recorder/albumart.c | 6 | ||||
-rw-r--r-- | apps/tree.c | 4 |
5 files changed, 13 insertions, 7 deletions
diff --git a/apps/iap/iap-lingo4.c b/apps/iap/iap-lingo4.c index 77ddeabcb3..eb629407f2 100644 --- a/apps/iap/iap-lingo4.c +++ b/apps/iap/iap-lingo4.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include "filetree.h" | 24 | #include "filetree.h" |
25 | #include "wps.h" | 25 | #include "wps.h" |
26 | #include "playback.h" | 26 | #include "playback.h" |
27 | #include "string-extra.h" | ||
27 | 28 | ||
28 | /* | 29 | /* |
29 | * This macro is meant to be used inside an IAP mode message handler. | 30 | * This macro is meant to be used inside an IAP mode message handler. |
@@ -1430,7 +1431,6 @@ void iap_handlepkt_mode4(const unsigned int len, const unsigned char *buf) | |||
1430 | unsigned int number_of_playlists = nbr_total_playlists(); | 1431 | unsigned int number_of_playlists = nbr_total_playlists(); |
1431 | uint32_t trackcount; | 1432 | uint32_t trackcount; |
1432 | trackcount = playlist_amount(); | 1433 | trackcount = playlist_amount(); |
1433 | size_t len; | ||
1434 | 1434 | ||
1435 | if ((buf[3] == 0x05) && ((start_index + read_count ) > trackcount)) | 1435 | if ((buf[3] == 0x05) && ((start_index + read_count ) > trackcount)) |
1436 | { | 1436 | { |
diff --git a/apps/onplay.c b/apps/onplay.c index 8d53e26fc5..8507699bd3 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -126,8 +126,8 @@ static bool clipboard_clip(struct clipboard *clip, const char *path, | |||
126 | unsigned int attr, unsigned int flags) | 126 | unsigned int attr, unsigned int flags) |
127 | { | 127 | { |
128 | /* if it fits it clips */ | 128 | /* if it fits it clips */ |
129 | if (strlcpy(clip->path, path, sizeof (clip->path)) | 129 | if (strmemccpy(clip->path, path, sizeof (clip->path)) != NULL) |
130 | < sizeof (clip->path)) { | 130 | { |
131 | clip->attr = attr; | 131 | clip->attr = attr; |
132 | clip->flags = flags; | 132 | clip->flags = flags; |
133 | return true; | 133 | return true; |
@@ -1048,7 +1048,7 @@ static int rename_file(void) | |||
1048 | size_t pathlen = oldbase - selection; | 1048 | size_t pathlen = oldbase - selection; |
1049 | char *newbase = newname + pathlen; | 1049 | char *newbase = newname + pathlen; |
1050 | 1050 | ||
1051 | if (strlcpy(newname, selection, sizeof (newname)) >= sizeof (newname)) { | 1051 | if (strmemccpy(newname, selection, sizeof (newname)) == NULL) { |
1052 | /* Too long */ | 1052 | /* Too long */ |
1053 | } else if (kbd_input(newbase, sizeof (newname) - pathlen, NULL) < 0) { | 1053 | } else if (kbd_input(newbase, sizeof (newname) - pathlen, NULL) < 0) { |
1054 | rc = OPRC_CANCELLED; | 1054 | rc = OPRC_CANCELLED; |
diff --git a/apps/playlist.c b/apps/playlist.c index ab5c59328a..b721a82093 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -1400,7 +1400,7 @@ static int get_filename(struct playlist_info* playlist, int index, int seek, | |||
1400 | 1400 | ||
1401 | if (playlist->in_ram && !control_file && max < 0) | 1401 | if (playlist->in_ram && !control_file && max < 0) |
1402 | { | 1402 | { |
1403 | max = strlcpy(tmp_buf, (char*)&playlist->buffer[seek], sizeof(tmp_buf)); | 1403 | strmemccpy(tmp_buf, (char*)&playlist->buffer[seek], sizeof(tmp_buf)); |
1404 | } | 1404 | } |
1405 | else if (max < 0) | 1405 | else if (max < 0) |
1406 | { | 1406 | { |
diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c index 8991a81848..c0d9e6d86f 100644 --- a/apps/recorder/albumart.c +++ b/apps/recorder/albumart.c | |||
@@ -39,6 +39,12 @@ | |||
39 | #define USE_JPEG_COVER | 39 | #define USE_JPEG_COVER |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #ifdef PLUGIN | ||
43 | #define strmemccpy strlcpy | ||
44 | /* Note we don't use the return value so this works */ | ||
45 | /* FIXME if strmemccpy gets added to the rb->plugin struct */ | ||
46 | #endif | ||
47 | |||
42 | /* Strip filename from a full path | 48 | /* Strip filename from a full path |
43 | * | 49 | * |
44 | * buf - buffer to extract directory to. | 50 | * buf - buffer to extract directory to. |
diff --git a/apps/tree.c b/apps/tree.c index 23a909281d..e8655cd0d0 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -511,10 +511,10 @@ char *getcwd(char *buf, getcwd_size_t size) | |||
511 | return tc.currdir; | 511 | return tc.currdir; |
512 | else if (size) | 512 | else if (size) |
513 | { | 513 | { |
514 | if ((getcwd_size_t)strlcpy(buf, tc.currdir, size) < size) | 514 | if (strmemccpy(buf, tc.currdir, size) != NULL) |
515 | return buf; | 515 | return buf; |
516 | } | 516 | } |
517 | /* size == 0, or truncation in strlcpy */ | 517 | /* size == 0, or truncation in strmemccpy */ |
518 | return NULL; | 518 | return NULL; |
519 | } | 519 | } |
520 | 520 | ||