1
0
Fork 0
forked from len0rd/rockbox

strlcpy finish cleanup

remove strlcpy & strlcat from string.h

document suspicious strlcpy call

convert strlcat.h users to string-extra

Change-Id: I313e75db86385c0e6d1aee75d252093be4935f60
This commit is contained in:
William Wilgus 2022-11-15 11:24:34 -05:00
parent 0b7a387671
commit 972810f6cf
7 changed files with 6 additions and 9 deletions

View file

@ -1387,7 +1387,7 @@ int split_string(char *str, const char split_char, char *vector[], const int vec
char sep[2] = {split_char, '\0'};
char *e, *p = strtok_r(str, sep, &e);
/* *p in the condition takes care of trailing splitters */
/* strtok takes care of leading & trailing splitters */
for(i = 0; i < vector_length; i++)
{
vector[i] = p;

View file

@ -227,6 +227,7 @@ void iso_decode_d_name(char *d_name)
return;
char shortname[13];
/* this only gets called in the case of DOS (8.3) filenames */
size_t len = strlcpy(shortname, d_name, sizeof (shortname));
/* This MUST be the default codepage thus not something that could be
loaded on call */

View file

@ -34,6 +34,6 @@ size_t strlcpy(char *dst, const char *src, size_t siz)
if (d)
return (d - dst - 1); /* count does not include NUL */
/* Not enough room in dst, add NUL and traverse rest of src */
/* Not enough room in dst, traverse rest of src */
return(siz + strlen(src+siz)); /* count does not include NUL */
}

View file

@ -20,8 +20,7 @@
****************************************************************************/
#include "zip.h"
#include <string.h>
#include "strlcpy.h"
#include "string-extra.h"
#include "file.h"
#include "dir.h"
#include "system.h"

View file

@ -22,7 +22,7 @@
#include "config.h"
#include "system.h"
#include "sys/types.h"
#include <string.h>
#include "string-extra.h"
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>

View file

@ -40,9 +40,6 @@ size_t _EXFUN(strspn,(const char *, const char *));
char *_EXFUN(strstr,(const char *, const char *));
char *_EXFUN(strcasestr,(const char *, const char *));
size_t strlcpy(char *dst, const char *src, size_t siz);
size_t strlcat(char *dst, const char *src, size_t siz);
#ifndef _REENT_ONLY
char *_EXFUN(strtok,(char *, const char *));
#endif

View file

@ -26,7 +26,7 @@
#include <stdlib.h>
#include <inttypes.h>
#include "platform.h"
#include "strlcpy.h"
#include "string-extra.h"
#include "strcasecmp.h"
#include "metadata.h"
#include "debug.h"