- Fix checking range of strings of struct iconv_add_in in libsmb and libkiconv,
- Add checking range of strings to iconv_sysctl_add(). Submitted by: Rudolf Cejka
This commit is contained in:
parent
f202203775
commit
a32dd5a151
@ -52,7 +52,7 @@ kiconv_add_xlat_table(const char *to, const char *from, const u_char *table)
|
||||
struct iconv_add_out dout;
|
||||
size_t olen;
|
||||
|
||||
if (strlen(from) > ICONV_CSNMAXLEN || strlen(to) > ICONV_CSNMAXLEN)
|
||||
if (strlen(from) >= ICONV_CSNMAXLEN || strlen(to) >= ICONV_CSNMAXLEN)
|
||||
return EINVAL;
|
||||
din.ia_version = ICONV_ADD_VER;
|
||||
strcpy(din.ia_converter, "xlat");
|
||||
|
@ -54,7 +54,7 @@ kiconv_add_xlat16_table(const char *to, const char *from, const void *data, int
|
||||
struct iconv_add_out dout;
|
||||
size_t olen;
|
||||
|
||||
if (strlen(from) > ICONV_CSNMAXLEN || strlen(to) > ICONV_CSNMAXLEN)
|
||||
if (strlen(from) >= ICONV_CSNMAXLEN || strlen(to) >= ICONV_CSNMAXLEN)
|
||||
return (EINVAL);
|
||||
din.ia_version = ICONV_ADD_VER;
|
||||
strcpy(din.ia_converter, "xlat16");
|
||||
|
@ -379,6 +379,12 @@ iconv_sysctl_add(SYSCTL_HANDLER_ARGS)
|
||||
return EINVAL;
|
||||
if (din.ia_datalen > ICONV_CSMAXDATALEN)
|
||||
return EINVAL;
|
||||
if (strlen(din.ia_from) >= ICONV_CSNMAXLEN)
|
||||
return EINVAL;
|
||||
if (strlen(din.ia_to) >= ICONV_CSNMAXLEN)
|
||||
return EINVAL;
|
||||
if (strlen(din.ia_converter) >= ICONV_CNVNMAXLEN)
|
||||
return EINVAL;
|
||||
if (iconv_lookupconv(din.ia_converter, &dcp) != 0)
|
||||
return EINVAL;
|
||||
error = iconv_register_cspair(din.ia_to, din.ia_from, dcp, NULL, &csp);
|
||||
|
Loading…
Reference in New Issue
Block a user