diff --git a/libs/libc/locale/lib_iconv.c b/libs/libc/locale/lib_iconv.c index cdd8179750..1a965a9b86 100644 --- a/libs/libc/locale/lib_iconv.c +++ b/libs/libc/locale/lib_iconv.c @@ -529,6 +529,11 @@ size_t iconv(iconv_t cd, FAR char **in, FAR size_t *inb, case UCS2: case UTF_16: { + if (scd == NULL) + { + goto starved; + } + l = 0; if (!scd->state) { @@ -551,6 +556,11 @@ size_t iconv(iconv_t cd, FAR char **in, FAR size_t *inb, case UTF_32: { + if (scd == NULL) + { + goto starved; + } + l = 0; if (!scd->state) { @@ -699,6 +709,11 @@ size_t iconv(iconv_t cd, FAR char **in, FAR size_t *inb, switch (128 * (c == '$') + d) { + if (scd == NULL) + { + goto starved; + } + case 'B': { scd->state = 0; @@ -733,6 +748,11 @@ size_t iconv(iconv_t cd, FAR char **in, FAR size_t *inb, goto ilseq; } + if (scd == NULL) + { + goto starved; + } + switch (scd->state) { case 1: