Skip to content

Commit f3fbcfb

Browse files
authored
Merge pull request #4 from rgacogne/add-missing-ipcrypt_str_to_ip16-checks
Add missing checks for `ipcrypt_str_to_ip16`
2 parents 70a4daf + f652d7b commit f3fbcfb

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/ipcrypt2.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,9 @@ ipcrypt_nd_encrypt_ip_str(const IPCrypt *ipcrypt, char encrypted_ip_str[IPCRYPT_
13831383

13841384
COMPILER_ASSERT(IPCRYPT_NDIP_STR_BYTES == IPCRYPT_NDIP_BYTES * 2 + 1);
13851385
// Convert to 16-byte IP.
1386-
ipcrypt_str_to_ip16(ip16, ip_str);
1386+
if (ipcrypt_str_to_ip16(ip16, ip_str) != 0) {
1387+
return 0;
1388+
}
13871389
// Perform non-deterministic encryption.
13881390
ipcrypt_nd_encrypt_ip16(ipcrypt, ndip, ip16, random);
13891391
// Convert the 24-byte ndip to a hex string.
@@ -1468,7 +1470,9 @@ ipcrypt_ndx_encrypt_ip_str(const IPCryptNDX *ipcrypt,
14681470

14691471
COMPILER_ASSERT(IPCRYPT_NDX_NDIP_STR_BYTES == IPCRYPT_NDX_NDIP_BYTES * 2 + 1);
14701472
// Convert to 16-byte IP.
1471-
ipcrypt_str_to_ip16(ip16, ip_str);
1473+
if (ipcrypt_str_to_ip16(ip16, ip_str) != 0) {
1474+
return 0;
1475+
}
14721476
// Perform non-deterministic encryption.
14731477
ipcrypt_ndx_encrypt_ip16(ipcrypt, ndip, ip16, random);
14741478
// Convert the 32-byte ndip to a hex string.

0 commit comments

Comments
 (0)