summaryrefslogtreecommitdiff
path: root/apps/iap
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-11-14 11:32:34 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2022-11-14 23:56:16 -0500
commitf6c719d7ec71cc7771c46d3daa390924a3871ba3 (patch)
treee6209f23565db01809f75067247e667963092ff6 /apps/iap
parentb25a9d8f99b75570d18ea64602de7fe48da612d6 (diff)
downloadrockbox-f6c719d7ec71cc7771c46d3daa390924a3871ba3.tar.gz
rockbox-f6c719d7ec71cc7771c46d3daa390924a3871ba3.zip
replace strlcpy with strmemccpy
replace applicable calls to strlcpy with calls to strmemccpy which null terminates on truncation in theory the strmemccpy calls should be slightly faster since they don't traverse the rest of the source string on truncation but I seriously doubt there is too much of that going on in the code base Change-Id: Ia0251514e36a6242bbf3f03c5e0df123aba60ed2
Diffstat (limited to 'apps/iap')
-rw-r--r--apps/iap/iap-lingo4.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/apps/iap/iap-lingo4.c b/apps/iap/iap-lingo4.c
index abb13eac02..77ddeabcb3 100644
--- a/apps/iap/iap-lingo4.c
+++ b/apps/iap/iap-lingo4.c
@@ -87,7 +87,7 @@ static void get_playlist_name(unsigned char *dest,
87 } 87 }
88 } 88 }
89 if (playlist_file != NULL) { 89 if (playlist_file != NULL) {
90 strlcpy(dest, playlist_file->d_name, max_length); 90 strmemccpy(dest, playlist_file->d_name, max_length);
91 } 91 }
92 closedir(dp); 92 closedir(dp);
93} 93}
@@ -1465,22 +1465,21 @@ void iap_handlepkt_mode4(const unsigned int len, const unsigned char *buf)
1465 switch(buf[3]) 1465 switch(buf[3])
1466 { 1466 {
1467 case 0x05: 1467 case 0x05:
1468 len = strlcpy((char *)&data[7], id3.title,64); 1468 strmemccpy((char *)&data[7], id3.title,64);
1469 break; 1469 break;
1470 case 0x02: 1470 case 0x02:
1471 len = strlcpy((char *)&data[7], id3.artist,64); 1471 strmemccpy((char *)&data[7], id3.artist,64);
1472 break; 1472 break;
1473 case 0x03: 1473 case 0x03:
1474 len = strlcpy((char *)&data[7], id3.album,64); 1474 strmemccpy((char *)&data[7], id3.album,64);
1475 break; 1475 break;
1476 case 0x04: 1476 case 0x04:
1477 case 0x06: 1477 case 0x06:
1478 len = strlcpy((char *)&data[7], "Not Supported",14); 1478 strmemccpy((char *)&data[7], "Not Supported",14);
1479 break; 1479 break;
1480 } 1480 }
1481 break; 1481 break;
1482 } 1482 }
1483 (void)len; /* Shut up, compiler */
1484 put_u32(&data[3], start_index+counter); 1483 put_u32(&data[3], start_index+counter);
1485 iap_send_pkt(data, 7 + strlen(data+7) + 1); 1484 iap_send_pkt(data, 7 + strlen(data+7) + 1);
1486 yield(); 1485 yield();