diff options
author | Kai Engert <kaie@kuix.de> | 2021-06-10 08:47:49 +0000 |
---|---|---|
committer | Kai Engert <kaie@kuix.de> | 2021-06-10 08:47:49 +0000 |
commit | dced6d4487171f54a0648bd259bfbac7c5881002 (patch) | |
tree | 91e8405f219012c95bb38637018e5d2a59be28d1 | |
parent | 1d4e53982bd859a32df415f4994cfb162bd730d7 (diff) | |
download | nspr-hg-dced6d4487171f54a0648bd259bfbac7c5881002.tar.gz |
Bug 1643866 - Use a larger buffer for internal calls to PR_GetHostByName. r=glandiumNSPR_4_32_BETA1
Differential Revision: https://phabricator.services.mozilla.com/D79921
-rw-r--r-- | pr/include/prnetdb.h | 7 | ||||
-rw-r--r-- | pr/src/misc/prnetdb.c | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/pr/include/prnetdb.h b/pr/include/prnetdb.h index 7a7ea863..8506d21c 100644 --- a/pr/include/prnetdb.h +++ b/pr/include/prnetdb.h @@ -49,8 +49,13 @@ typedef struct PRHostEnt { /* A safe size to use that will mostly work... */ #if (defined(AIX) && defined(_THREAD_SAFE)) #define PR_NETDB_BUF_SIZE sizeof(struct protoent_data) +#define PR_MIN_NETDB_BUF_SIZE PR_NETDB_BUF_SIZE #else -#define PR_NETDB_BUF_SIZE 1024 +/* PR_NETDB_BUF_SIZE is the recommended buffer size */ +#define PR_NETDB_BUF_SIZE 2048 +/* PR_MIN_NETDB_BUF_SIZE is the smallest buffer size that the API + * accepts (for backward compatibility). */ +#define PR_MIN_NETDB_BUF_SIZE 1024 #endif /*********************************************************************** diff --git a/pr/src/misc/prnetdb.c b/pr/src/misc/prnetdb.c index 0f645b64..baf49d81 100644 --- a/pr/src/misc/prnetdb.c +++ b/pr/src/misc/prnetdb.c @@ -1248,7 +1248,7 @@ PR_IMPLEMENT(PRStatus) PR_GetProtoByName( } #endif /* defined(_PR_HAVE_GETPROTO_R_INT) */ - if (PR_NETDB_BUF_SIZE > buflen) + if (PR_MIN_NETDB_BUF_SIZE > buflen) { PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); return PR_FAILURE; @@ -1331,7 +1331,7 @@ PR_IMPLEMENT(PRStatus) PR_GetProtoByNumber( } #endif /* defined(_PR_HAVE_GETPROTO_R_INT) */ - if (PR_NETDB_BUF_SIZE > buflen) + if (PR_MIN_NETDB_BUF_SIZE > buflen) { PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); return PR_FAILURE; |