Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Commit c69b447

Browse files
committed
fix: DC table initializers put port 443 into ipv6 field, add -Werror CI
The struct dc_address gained an ipv6[16] field between ipv4 and port, but the positional initializers { 1, 0, 443 } were not updated — 443 went into ipv6[0] (unsigned char, truncated to 187) instead of port. Switch to designated initializers (.dc_id, .port) to prevent this class of bug. Add a build-werror CI job that compiles with -Werror to catch compiler warnings before they reach releases. The main Makefile keeps -Wall without -Werror so end-user builds aren't broken by compiler differences.
1 parent b845aeb commit c69b447

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

.github/workflows/test.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,21 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
jobs:
14+
# Fast compile-only check: ensures no compiler warnings slip through.
15+
# The main build uses -Wall but not -Werror, so warnings don't fail the
16+
# build for end users on different compiler versions. This CI job adds
17+
# -Werror to catch regressions like the dc-table overflow in v3.5.3.
18+
build-werror:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Install dependencies
23+
run: |
24+
sudo apt-get update
25+
sudo apt-get install -y build-essential libssl-dev zlib1g-dev
26+
- name: Build with -Werror
27+
run: make clean && make -j$(nproc) EXTRA_CFLAGS="-Werror"
28+
1429
test:
1530
runs-on: ubuntu-latest
1631
steps:

mtproto/mtproto-dc-table.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@
3030
*/
3131

3232
static const struct dc_address production_dcs[] = {
33-
{ 1, 0, 443 }, /* 149.154.175.50 */
34-
{ 2, 0, 443 }, /* 149.154.167.51 */
35-
{ 3, 0, 443 }, /* 149.154.175.100 */
36-
{ 4, 0, 443 }, /* 149.154.167.91 */
37-
{ 5, 0, 443 }, /* 91.108.56.100 */
33+
{ .dc_id = 1, .port = 443 }, /* 149.154.175.50 */
34+
{ .dc_id = 2, .port = 443 }, /* 149.154.167.51 */
35+
{ .dc_id = 3, .port = 443 }, /* 149.154.175.100 */
36+
{ .dc_id = 4, .port = 443 }, /* 149.154.167.91 */
37+
{ .dc_id = 5, .port = 443 }, /* 91.108.56.100 */
3838
};
3939

4040
static const struct dc_address test_dcs[] = {
41-
{ 1, 0, 443 }, /* 149.154.175.10 */
42-
{ 2, 0, 443 }, /* 149.154.167.40 */
43-
{ 3, 0, 443 }, /* 149.154.175.117 */
41+
{ .dc_id = 1, .port = 443 }, /* 149.154.175.10 */
42+
{ .dc_id = 2, .port = 443 }, /* 149.154.167.40 */
43+
{ .dc_id = 3, .port = 443 }, /* 149.154.175.117 */
4444
};
4545

4646
static int dc_table_initialized;

0 commit comments

Comments
 (0)