diff options
| author | Hauke Mehrtens | 2026-05-31 15:27:09 +0000 |
|---|---|---|
| committer | Hauke Mehrtens | 2026-06-07 11:24:33 +0000 |
| commit | 9dd0055d527d5fee1cb37f8debe28d2762150236 (patch) | |
| tree | 5c6026749fa8b5f9bf659b5d67c3e453096ddeea | |
| parent | 0ba47f319b09d02d101b234c2d7c53419b929a7a (diff) | |
| download | uclient-9dd0055d527d5fee1cb37f8debe28d2762150236.tar.gz | |
uclient: initialize *port for unknown address families
uclient_get_addr() returned early without writing *port when the
address family was neither AF_INET nor AF_INET6. Callers such as the
ucode binding's status() pass a pointer and immediately use the result,
so for an as-yet-unconnected client (zeroed local/remote_addr) they read
and report an uninitialized port value. Set *port to 0 in that case.
Assisted-by: Claude:claude-opus-4-8
Link: https://github.com/openwrt/uclient/pull/16
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
| -rw-r--r-- | uclient.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -43,6 +43,8 @@ char *uclient_get_addr(char *dest, int *port, union uclient_addr *a) portval = a->sin6.sin6_port; break; default: + if (port) + *port = 0; return strcpy(dest, "Unknown"); } |