Skip to content

Commit

Permalink
Making safer a strcpy + eliminating an invalid comment
Browse files Browse the repository at this point in the history
  • Loading branch information
AbelPau committed Apr 17, 2024
1 parent 5f58978 commit 77860ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 4 additions & 1 deletion ogr/ogrsf_frmts/miramon/mm_gdal_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -2407,7 +2407,10 @@ int MM_SecureCopyStringFieldValue(char **pszStringDst, const char *pszStringSrc,
(*pszStringDst) = new_ptr;
*nStringCurrentLength = (MM_EXT_DBF_N_FIELDS)(strlen(pszStringSrc) + 1);
}
strcpy(*pszStringDst, pszStringSrc);
if (*pszStringSrc == '\0')
*pszStringDst = '\0';
else
strcpy(*pszStringDst, pszStringSrc);
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion ogr/ogrsf_frmts/miramon/ogrmiramonlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2365,7 +2365,6 @@ OGRErr OGRMiraMonLayer::TranslateFieldsValuesToMM(OGRFeature *poFeature)
hMMFeature.pRecords[0].nNumField))
return OGRERR_NOT_ENOUGH_MEMORY;

// MiraMon encoding is ISO 8859-1 (Latin1) -> Recode from UTF-8
if (MM_SecureCopyStringFieldValue(
&hMMFeature.pRecords[0].pField[iField].pDinValue,
pszRawValue,
Expand Down

0 comments on commit 77860ec

Please sign in to comment.