nginx/src/core
Andrew Clayton b0a4d0fb82 Avoid undefined behaviour in ngx_pstrdup()
In the third call to ngx_pstrdup() for setting cycle->conf_param.data in
ngx_init_cycle() we would pass in a nulled ngx_str_t in the case there
was no -g command line option passed to nginx.

This would result in a

  memcpy(dst, NULL, 0)

which up to and including C23 is Undefined Behaviour.

Currently Clang and GCC (in this particular case) just treat this as a
no-op, so things just happen to work.

However some undefined behaviour sanitizers will throw an error when
this is hit, e.g. Clang and the zig compiler and it's probably best not
to rely on this behaviour.

It's worth noting that the next C standard will make this (and other
NULL related operations) defined behaviour.

Link: <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>
Closes: https://github.com/nginx/nginx/issues/1079
2026-04-20 19:56:40 +01:00
..
nginx.c Core: fixed environment variables on exit. 2023-07-19 05:09:23 +03:00
nginx.h Version bump 2026-04-13 14:20:23 +01:00
ngx_array.c
ngx_array.h
ngx_bpf.c Core: fixed build with BPF on non-64bit platforms (ticket #2152). 2021-03-23 10:58:18 +03:00
ngx_bpf.h Core: added interface to linux bpf() system call. 2020-12-15 15:23:07 +03:00
ngx_buf.c Changed ngx_chain_update_chains() to test tag first (ticket #2248). 2021-10-30 02:39:19 +03:00
ngx_buf.h Simplified sendfile(SF_NODISKIO) usage. 2021-12-27 19:48:33 +03:00
ngx_conf_file.c Style. 2022-12-16 01:15:15 +04:00
ngx_conf_file.h
ngx_config.h Core: improved NGX_ALIGNMENT detection on some x86_64 platforms. 2025-04-18 12:57:26 -07:00
ngx_connection.c The "multipath" parameter of the "listen" directive. 2026-03-19 01:13:51 +04:00
ngx_connection.h The "multipath" parameter of the "listen" directive. 2026-03-19 01:13:51 +04:00
ngx_core.h Upstream: fixed --with-compat build without SSL, broken by 454ad0e. 2025-01-23 10:50:13 -08:00
ngx_cpuinfo.c
ngx_crc.h
ngx_crc32.c
ngx_crc32.h
ngx_crypt.c
ngx_crypt.h
ngx_cycle.c Avoid undefined behaviour in ngx_pstrdup() 2026-04-20 19:56:40 +01:00
ngx_cycle.h Core: "-e" command line option. 2020-11-19 16:59:00 +00:00
ngx_file.c
ngx_file.h
ngx_hash.c Core: removed unnecessary restriction in hash initialization. 2021-08-19 20:51:27 +03:00
ngx_hash.h FastCGI: combining headers with identical names (ticket #1724). 2022-05-30 21:25:27 +03:00
ngx_inet.c Realip: allowed square brackets with portless IPv6 address. 2024-11-26 18:27:07 +04:00
ngx_inet.h
ngx_list.c
ngx_list.h
ngx_log.c Core: "-e" command line option. 2020-11-19 16:59:00 +00:00
ngx_log.h Added COMPAT section to ngx_log_t. 2026-03-23 09:38:11 -07:00
ngx_md5.c
ngx_md5.h
ngx_module.c
ngx_module.h Modules compatibility: added QUIC to signature (ticket #2539). 2023-09-13 17:48:15 +04:00
ngx_murmurhash.c
ngx_murmurhash.h
ngx_open_file_cache.c
ngx_open_file_cache.h
ngx_output_chain.c Output chain: clear the last_buf flag unless inherited. 2026-01-29 14:52:41 +04:00
ngx_palloc.c
ngx_palloc.h
ngx_parse.c
ngx_parse.h
ngx_parse_time.c
ngx_parse_time.h
ngx_proxy_protocol.c Fixed PROXY protocol to use ngx_memcpy()/ngx_memcmp(). 2022-11-08 12:48:21 +03:00
ngx_proxy_protocol.h Increased maximum read PROXY protocol header size. 2022-11-02 13:46:16 +04:00
ngx_queue.c Core: changed ngx_queue_sort() to use merge sort. 2023-10-18 04:30:11 +03:00
ngx_queue.h Core: changed ngx_queue_sort() to use merge sort. 2023-10-18 04:30:11 +03:00
ngx_radix_tree.c
ngx_radix_tree.h
ngx_rbtree.c
ngx_rbtree.h Core: added the ngx_rbtree_data() macro. 2021-06-21 09:42:43 +03:00
ngx_regex.c Core: fixed memory leak on configuration reload with PCRE2. 2023-10-17 02:39:38 +03:00
ngx_regex.h Core: added NGX_REGEX_MULTILINE for 3rd party modules. 2021-12-25 01:07:18 +03:00
ngx_resolver.c Resolver: fixed off-by-one read in ngx_resolver_copy(). 2026-02-23 22:12:32 +04:00
ngx_resolver.h The "ipv4=" parameter of the "resolver" directive. 2022-07-12 21:44:02 +04:00
ngx_rwlock.c Core: simplify reader lock release. 2022-01-19 17:37:34 -08:00
ngx_rwlock.h
ngx_sha1.c
ngx_sha1.h
ngx_shmtx.c
ngx_shmtx.h
ngx_slab.c
ngx_slab.h
ngx_spinlock.c
ngx_string.c Mail: xtext encoding (RFC 3461) in XCLIENT LOGIN. 2025-09-26 17:04:20 +04:00
ngx_string.h Mail: xtext encoding (RFC 3461) in XCLIENT LOGIN. 2025-09-26 17:04:20 +04:00
ngx_syslog.c Syslog: introduced error log handler. 2023-03-10 07:43:50 +03:00
ngx_syslog.h Syslog: introduced error log handler. 2023-03-10 07:43:50 +03:00
ngx_thread_pool.c Use NULL instead of 0 for null pointer constant. 2025-06-21 10:36:45 +04:00
ngx_thread_pool.h
ngx_times.c Removed CLOCK_MONOTONIC_FAST support. 2026-04-03 11:57:21 -07:00
ngx_times.h