Skip to content

Commit 21e2126

Browse files
authored
Merge pull request #288 from Castaglia/proxy-missing-default-reverse-servers
Address a possible null pointer dereference due to bad configurations…
2 parents bcb6126 + f3a042f commit 21e2126

File tree

1 file changed

+15
-4
lines changed
  • lib/proxy/reverse

1 file changed

+15
-4
lines changed

lib/proxy/reverse/db.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* ProFTPD - mod_proxy reverse datastore implementation
3-
* Copyright (c) 2012-2021 TJ Saunders
3+
* Copyright (c) 2012-2025 TJ Saunders
44
*
55
* This program is free software; you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -1507,10 +1507,21 @@ static const struct proxy_conn *reverse_db_policy_next_backend(pool *p,
15071507

15081508
if (proxy_reverse_policy_is_sticky(policy_id) != TRUE) {
15091509
if (conns == NULL &&
1510-
default_backends != NULL &&
15111510
db_backends == NULL) {
1512-
conns = default_backends->elts;
1513-
nelts = default_backends->nelts;
1511+
1512+
if (default_backends != NULL) {
1513+
conns = default_backends->elts;
1514+
nelts = default_backends->nelts;
1515+
1516+
} else {
1517+
/* Prevent possible null pointer dereferences later due to missing
1518+
* default URIs for non-sticky ConnectPolicy configurations.
1519+
*/
1520+
pr_log_writefile(proxy_logfd, MOD_PROXY_VERSION,
1521+
"missing required default/global ProxyReverseServers");
1522+
errno = EPERM;
1523+
return NULL;
1524+
}
15141525
}
15151526
}
15161527

0 commit comments

Comments
 (0)