Skip to content

Commit a5ffa8f

Browse files
committed
Guard against bug in Solaris' bsearch(), per Michael Wildpaner.
1 parent a5a6876 commit a5ffa8f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/backend/libpq/hba.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.117 2003/11/29 19:51:49 pgsql Exp $
13+
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.118 2003/12/05 15:50:31 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -381,6 +381,10 @@ user_group_bsearch_cmp(const void *user, const void *list)
381381
static List **
382382
get_group_line(const char *group)
383383
{
384+
/* On some versions of Solaris, bsearch of zero items dumps core */
385+
if (group_length == 0)
386+
return NULL;
387+
384388
return (List **) bsearch((void *) group,
385389
(void *) group_sorted,
386390
group_length,
@@ -392,9 +396,13 @@ get_group_line(const char *group)
392396
/*
393397
* Lookup a user name in the pg_shadow file
394398
*/
395-
List **
399+
List **
396400
get_user_line(const char *user)
397401
{
402+
/* On some versions of Solaris, bsearch of zero items dumps core */
403+
if (user_length == 0)
404+
return NULL;
405+
398406
return (List **) bsearch((void *) user,
399407
(void *) user_sorted,
400408
user_length,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy