"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/common/convert.c" between
libextractor-1.8.tar.gz and libextractor-1.9.tar.gz

About: GNU libextractor is a library used to extract meta-data from files of arbitrary type.

convert.c  (libextractor-1.8):convert.c  (libextractor-1.9)
skipping to change at line 55 skipping to change at line 55
size_t finSize; size_t finSize;
char *tmp; char *tmp;
char *ret; char *ret;
char *itmp; char *itmp;
const char *i; const char *i;
iconv_t cd; iconv_t cd;
i = input; i = input;
cd = iconv_open ("UTF-8", charset); cd = iconv_open ("UTF-8", charset);
if (cd == (iconv_t) - 1) if (cd == (iconv_t) - 1)
return strdup (i); return strndup (i, len);
if (len > 1024 * 1024) if (len > 1024 * 1024)
{ {
iconv_close (cd); iconv_close (cd);
return NULL; /* too big for meta data */ return NULL; /* too big for meta data */
} }
tmpSize = 3 * len + 4; tmpSize = 3 * len + 4;
tmp = malloc (tmpSize); tmp = malloc (tmpSize);
if (tmp == NULL) if (tmp == NULL)
{ {
iconv_close (cd); iconv_close (cd);
return NULL; return NULL;
} }
itmp = tmp; itmp = tmp;
finSize = tmpSize; finSize = tmpSize;
if (iconv (cd, (char **) &input, &len, &itmp, &finSize) == SIZE_MAX) if (iconv (cd, (char **) &input, &len, &itmp, &finSize) == ((size_t) -1))
{ {
iconv_close (cd); iconv_close (cd);
free (tmp); free (tmp);
return strdup (i); return strndup (i, len);
} }
ret = malloc (tmpSize - finSize + 1); ret = malloc (tmpSize - finSize + 1);
if (ret == NULL) if (ret == NULL)
{ {
iconv_close (cd); iconv_close (cd);
free (tmp); free (tmp);
return NULL; return NULL;
} }
memcpy (ret, tmp, tmpSize - finSize); memcpy (ret, tmp, tmpSize - finSize);
ret[tmpSize - finSize] = '\0'; ret[tmpSize - finSize] = '\0';
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)