From bf667e7e9c45b0b0c3787c1023c3b0f6de284cd8 Mon Sep 17 00:00:00 2001 From: erin_yueh Date: Wed, 13 Feb 2008 03:48:28 +0000 Subject: gsmd: add strlcpy, strlcat functions (Paulius Zaleckas) git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@4060 99fdad57-331a-0410-800a-d7fa5415bdb3 --- include/gsmd/extrsp.h | 4 +++- include/gsmd/gsmd.h | 1 + include/gsmd/strl.h | 12 ++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 include/gsmd/strl.h (limited to 'include') diff --git a/include/gsmd/extrsp.h b/include/gsmd/extrsp.h index 1f6e6a5..f7c1430 100644 --- a/include/gsmd/extrsp.h +++ b/include/gsmd/extrsp.h @@ -7,6 +7,8 @@ /* how many individual sub-ranges can one range contain */ #define GSM_EXTRSP_MAX_RANGES 16 +/* how many character we are going to store in string buffer */ +#define GSM_EXTRSP_MAX_STRBUF 64 struct gsm_extrsp_range_item { int min; @@ -28,7 +30,7 @@ struct gsm_extrsp_tok { struct gsm_extrsp_range_item item[GSM_EXTRSP_MAX_RANGES]; int num_items; } range; - char string[64]; + char string[GSM_EXTRSP_MAX_STRBUF]; int numeric; } u; }; diff --git a/include/gsmd/gsmd.h b/include/gsmd/gsmd.h index 585d78d..0521dd5 100644 --- a/include/gsmd/gsmd.h +++ b/include/gsmd/gsmd.h @@ -12,6 +12,7 @@ #include #include #include +#include void *gsmd_tallocs; diff --git a/include/gsmd/strl.h b/include/gsmd/strl.h new file mode 100644 index 0000000..de96ab4 --- /dev/null +++ b/include/gsmd/strl.h @@ -0,0 +1,12 @@ +#ifndef __GSMD_STRL_H +#define __GSMD_STRL_H + +#ifdef __GSMD__ + +/* safe strcpy and strcat versions */ +extern size_t strlcpy(char *dest, const char *src, size_t size); +extern size_t strlcat(char *dest, const char *src, size_t count); + +#endif /* __GSMD__ */ + +#endif -- cgit v1.2.3