From f6c719d7ec71cc7771c46d3daa390924a3871ba3 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Mon, 14 Nov 2022 11:32:34 -0500 Subject: 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 --- apps/iap/iap-lingo4.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'apps/iap/iap-lingo4.c') 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, } } if (playlist_file != NULL) { - strlcpy(dest, playlist_file->d_name, max_length); + strmemccpy(dest, playlist_file->d_name, max_length); } closedir(dp); } @@ -1465,22 +1465,21 @@ void iap_handlepkt_mode4(const unsigned int len, const unsigned char *buf) switch(buf[3]) { case 0x05: - len = strlcpy((char *)&data[7], id3.title,64); + strmemccpy((char *)&data[7], id3.title,64); break; case 0x02: - len = strlcpy((char *)&data[7], id3.artist,64); + strmemccpy((char *)&data[7], id3.artist,64); break; case 0x03: - len = strlcpy((char *)&data[7], id3.album,64); + strmemccpy((char *)&data[7], id3.album,64); break; case 0x04: case 0x06: - len = strlcpy((char *)&data[7], "Not Supported",14); + strmemccpy((char *)&data[7], "Not Supported",14); break; } break; } - (void)len; /* Shut up, compiler */ put_u32(&data[3], start_index+counter); iap_send_pkt(data, 7 + strlen(data+7) + 1); yield(); -- cgit v1.2.3