[Replicant] [PATCH] samsung-ipc: rfs: fix incorrect sign comparison for md5 file length

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Tue Dec 1 21:46:08 UTC 2020


On Tue,  1 Dec 2020 21:03:59 +0200
Joonas Kylmälä <joonas.kylmala at iki.fi> wrote:

> +#define MD5_DIGEST_LENGTH_ASCII (2 * MD5_DIGEST_LENGTH)
> +
>  char *ipc_nv_data_md5_calculate(struct ipc_client *client,
>  				const char *path, const char *secret,
>  				size_t size, size_t chunk_size)
> @@ -112,7 +114,7 @@ int ipc_nv_data_md5_path_check(struct ipc_client
> *client) return -1;
>  	}
>  
> -	if (st.st_size < 2 * sizeof(char) * MD5_DIGEST_LENGTH) {
> +	if (st.st_size != MD5_DIGEST_LENGTH_ASCII) {
>  		ipc_client_log(client, "Checking nv_data md5 size
Thanks a lot, that looks way cleaner. 

Besides the very long line in the commit ("rfs.c:115:17: error:
comparison of integer expressions of different signedness: ‘__off_t’
{aka ‘long int’} and ‘long unsigned int’ [-Werror=sign-compare]") that
needs to be spitted, everything looks good.

The warnings are also gone in all the configuration tested by the
Guix.scm.

I can take care of that right pushing it though if you want.

> I couldn't do any real device testing because I don't have any storage
> space to build replicant 6 and would have had to delete replicant 11
> work to do this so if this patch looks good to you it would be awesome
> if you could give it a spin on a real device.
That indeed needs to be tested. I'll try to test it on my main device,
however it might take a bit of delay (I'm also in the middle of merging
the patchset to remove the Ambient SDK and I need to do a backup of the
phone data too).

Denis.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osuosl.org/pipermail/replicant/attachments/20201201/2f6b5e78/attachment.asc>


More information about the Replicant mailing list