### Bug Summary

File: | ui/help_url.c
Warning: | line 333, column 9 Value stored to 'url' is never read

### Annotated Source Code

Press '?' to see keyboard shortcuts

Show analyzer invocation
clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name help_url.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -fno-delete-null-pointer-checks -mframe-pointer=all -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -ffloat16-excess-precision=fast -fbfloat16-excess-precision=fast -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/builds/wireshark/wireshark/build -fcoverage-compilation-dir=/builds/wireshark/wireshark/build -resource-dir /usr/lib/llvm-21/lib/clang/21 -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -D G_DISABLE_DEPRECATED -D G_DISABLE_SINGLE_INCLUDES -D WS_DEBUG -D WS_DEBUG_UTF_8 -I /builds/wireshark/wireshark/build -I /builds/wireshark/wireshark -I /builds/wireshark/wireshark/include -I /builds/wireshark/wireshark/ui -I /builds/wireshark/wireshark/build/ui -I /builds/wireshark/wireshark/wiretap -D _GLIBCXX_ASSERTIONS -internal-isystem /usr/lib/llvm-21/lib/clang/21/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fmacro-prefix-map=/builds/wireshark/wireshark/= -fmacro-prefix-map=/builds/wireshark/wireshark/build/= -fmacro-prefix-map=../= -Wno-format-nonliteral -std=gnu11 -ferror-limit 19 -fvisibility=hidden -fwrapv -fwrapv-pointer -fstrict-flex-arrays=3 -stack-protector 2 -fstack-clash-protection -fcf-protection=full -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fexceptions -fcolor-diagnostics -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /builds/wireshark/wireshark/sbout/2025-12-01-100317-3592-1 -x c /builds/wireshark/wireshark/ui/help_url.c

Keyboard shortcuts:

- Use 'j/k' keys for keyboard navigation
- Use 'Shift+S' to show/hide relevant lines
- Use '?' to toggle this window

Close
Show only relevant lines Show control flow arrows

1 | /* help_url.c
2 | *
3 | * Some content from gtk/help_dlg.c by Laurent Deniel <laurent.deniel@free.fr>
4 | *
5 | * Wireshark - Network traffic analyzer
6 | * By Gerald Combs <gerald@wireshark.org>
7 | * Copyright 2000 Gerald Combs
8 | *
9 | * SPDX-License-Identifier: GPL-2.0-or-later
10 | */
11 |
12 | #include "config.h"
13 |
14 | #include <string.h>
15 |
16 | #include <glib.h>
17 |
18 | #include "help_url.h"
19 | #include "urls.h"
20 | #include "wsutil/filesystem.h"
21 | #include <wsutil/ws_assert.h>
22 | #include <wsutil/application_flavor.h>
23 |
24 | // To do:
25 | // - Automatically generate part or all of this, e.g. by parsing
26 | // the DocBook XML or the chunked HTML.
27 |
28 | /*
29 | * Open the help dialog and show a specific HTML help page.
30 | */
31 | char *
32 | user_guide_url(const char *page) {
33 | GString *url = g_string_new("");
34 |
35 | #if defined(_WIN32)
36 | /*
37 | * The User's Guide is in a directory named "Wireshark User's Guide" in
38 | * the program directory.
39 | */
40 |
41 | GString *ug_dir = g_string_new("");
42 | g_string_printf(ug_dir, "%s\\Wireshark User's Guide", get_datafile_dir(application_configuration_environment_prefix()));
43 | if (g_file_test(ug_dir->str, G_FILE_TEST_IS_DIR)) {
44 | g_string_printf(url, "file:///%s/%s", ug_dir->str, page);
45 | }
46 | g_string_free(ug_dir, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) ( (ug_dir), ((!(0)))) : g_string_free_and_steal (ug_dir)) : (g_string_free ) ((ug_dir), ((!(0)))));
47 | #else
48 | char *path = g_build_filename(get_doc_dir(application_configuration_environment_prefix()), "wsug_html_chunked", page, NULL((void*)0));
49 | if (g_file_test(path, G_FILE_TEST_IS_REGULAR)) {
50 | /* try to open the HTML page from the filesystem */
51 | g_string_printf(url, "file://%s", path);
52 | }
53 | g_free(path);
54 | path = NULL((void*)0);
55 | #endif /* _WIN32 */
56 |
57 |
58 | /* Fall back to wireshark.org. */
59 | if (url->len == 0) {
60 | g_string_printf(url, WS_DOCS_URL"https://www.wireshark.org/docs/" "wsug_html_chunked/%s", page);
61 | }
62 | return g_string_free(url, FALSE)(__builtin_constant_p ((0)) ? (((0)) ? (g_string_free) ((url) , ((0))) : g_string_free_and_steal (url)) : (g_string_free) ( (url), ((0))));
63 | }
64 |
65 | char *
66 | topic_action_url(topic_action_e action)
67 | {
68 | char *url;
69 |
70 | switch(action) {
71 | /* pages online at www.wireshark.org */
72 | case(ONLINEPAGE_WIRESHARK_HOME):
73 | url = g_strdup(WS_HOME_PAGE_URL)g_strdup_inline ("https://www.wireshark.org");
74 | break;
75 | case(ONLINEPAGE_WIRESHARK_WIKI):
76 | url = g_strdup(WS_WIKI_HOME_URL)g_strdup_inline ("https://wiki.wireshark.org");
77 | break;
78 | case(ONLINEPAGE_WIRESHARK_DOWNLOAD):
79 | url = g_strdup(WS_DOWNLOAD_URL)g_strdup_inline ("https://www.wireshark.org/download.html");
80 | break;
81 | case(ONLINEPAGE_DOCS):
82 | url = g_strdup(WS_DOCS_URL)g_strdup_inline ("https://www.wireshark.org/docs/");
83 | break;
84 | case(ONLINEPAGE_USERGUIDE):
85 | url = g_strdup(WS_DOCS_URL "wsug_html_chunked/")g_strdup_inline ("https://www.wireshark.org/docs/" "wsug_html_chunked/" );
86 | break;
87 | case(ONLINEPAGE_FAQ):
88 | url = g_strdup(WS_FAQ_URL)g_strdup_inline ("https://www.wireshark.org/faq.html");
89 | break;
90 | case(ONLINEPAGE_ASK):
91 | url = g_strdup(WS_Q_AND_A_URL)g_strdup_inline ("https://ask.wireshark.org");
92 | break;
93 | case(ONLINEPAGE_SAMPLE_FILES):
94 | url = g_strdup(WS_WIKI_URL("SampleCaptures"))g_strdup_inline ("https://wiki.wireshark.org" "/" "SampleCaptures" );
95 | break;
96 | case(ONLINEPAGE_CAPTURE_SETUP):
97 | url = g_strdup(WS_WIKI_URL("CaptureSetup"))g_strdup_inline ("https://wiki.wireshark.org" "/" "CaptureSetup" );
98 | break;
99 | case(ONLINEPAGE_NETWORK_MEDIA):
100 | url = g_strdup(WS_WIKI_URL("CaptureSetup/NetworkMedia"))g_strdup_inline ("https://wiki.wireshark.org" "/" "CaptureSetup/NetworkMedia" );
101 | break;
102 | case(ONLINEPAGE_SAMPLE_CAPTURES):
103 | url = g_strdup(WS_WIKI_URL("SampleCaptures"))g_strdup_inline ("https://wiki.wireshark.org" "/" "SampleCaptures" );
104 | break;
105 | case(ONLINEPAGE_SECURITY):
106 | url = g_strdup(WS_WIKI_URL("Security"))g_strdup_inline ("https://wiki.wireshark.org" "/" "Security");
107 | break;
108 | case(ONLINEPAGE_DFILTER_REF):
109 | url = g_strdup(WS_DOCS_URL "dfref/")g_strdup_inline ("https://www.wireshark.org/docs/" "dfref/");
110 | break;
111 |
112 | /* pages online at stratoshark.org */
113 | case(ONLINEPAGE_STRATOSHARK_HOME):
114 | url = g_strdup(SS_HOME_PAGE_URL)g_strdup_inline ("https://stratoshark.org");
115 | break;
116 | case(ONLINEPAGE_STRATOSHARK_WIKI):
117 | url = g_strdup(SS_WIKI_HOME_URL)g_strdup_inline ("https://wiki.wireshark.org/stratoshark");
118 | break;
119 | case(ONLINEPAGE_STRATOSHARK_DOWNLOAD):
120 | url = g_strdup(SS_DOWNLOAD_URL)g_strdup_inline ("https://stratoshark.org");
121 | break;
122 |
123 | /* local manual pages */
124 | case(LOCALPAGE_MAN_WIRESHARK):
125 | url = doc_file_url("wireshark.html", application_configuration_environment_prefix());
126 | break;
127 | case(LOCALPAGE_MAN_STRATOSHARK):
128 | url = doc_file_url("stratoshark.html", application_configuration_environment_prefix());
129 | break;
130 | case(LOCALPAGE_MAN_WIRESHARK_FILTER):
131 | url = doc_file_url("wireshark-filter.html", application_configuration_environment_prefix());
132 | break;
133 | case(LOCALPAGE_MAN_CAPINFOS):
134 | url = doc_file_url("capinfos.html", application_configuration_environment_prefix());
135 | break;
136 | case(LOCALPAGE_MAN_DUMPCAP):
137 | url = doc_file_url("dumpcap.html", application_configuration_environment_prefix());
138 | break;
139 | case(LOCALPAGE_MAN_EDITCAP):
140 | url = doc_file_url("editcap.html", application_configuration_environment_prefix());
141 | break;
142 | case(LOCALPAGE_MAN_MERGECAP):
143 | url = doc_file_url("mergecap.html", application_configuration_environment_prefix());
144 | break;
145 | case(LOCALPAGE_MAN_RAWSHARK):
146 | url = doc_file_url("rawshark.html", application_configuration_environment_prefix());
147 | break;
148 | case(LOCALPAGE_MAN_REORDERCAP):
149 | url = doc_file_url("reordercap.html", application_configuration_environment_prefix());
150 | break;
151 | case(LOCALPAGE_MAN_TEXT2PCAP):
152 | url = doc_file_url("text2pcap.html", application_configuration_environment_prefix());
153 | break;
154 | case(LOCALPAGE_MAN_TSHARK):
155 | url = doc_file_url("tshark.html", application_configuration_environment_prefix());
156 | break;
157 |
158 | /* Release Notes */
159 | case(LOCALPAGE_WIRESHARK_RELEASE_NOTES):
160 | url = doc_file_url("Wireshark Release Notes.html", application_configuration_environment_prefix());
161 | break;
162 | case(LOCALPAGE_STRATOSHARK_RELEASE_NOTES):
163 | url = doc_file_url("Stratoshark Release Notes.html", application_configuration_environment_prefix());
164 | break;
165 |
166 | /* local help pages (User's Guide) */
167 | case(HELP_CONTENT):
168 | url = user_guide_url( "index.html");
169 | break;
170 | case(HELP_CAPTURE_OPTIONS):
171 | url = user_guide_url("ChCapCaptureOptions.html");
172 | break;
173 | case(HELP_CAPTURE_FILTERS_DIALOG):
174 | url = user_guide_url("ChWorkDefineFilterSection.html");
175 | break;
176 | case(HELP_DISPLAY_FILTERS_DIALOG):
177 | url = user_guide_url("ChWorkDefineFilterSection.html");
178 | break;
179 | case(HELP_DISPLAY_MACRO_DIALOG):
180 | url = user_guide_url("ChWorkDefineFilterMacrosSection.html");
181 | break;
182 | case(HELP_FILTER_EXPRESSION_DIALOG):
183 | url = user_guide_url("ChWorkFilterAddExpressionSection.html");
184 | break;
185 | case(HELP_COLORING_RULES_DIALOG):
186 | url = user_guide_url("ChCustColorizationSection.html");
187 | break;
188 | case(HELP_CONFIG_PROFILES_DIALOG):
189 | url = user_guide_url("ChCustConfigProfilesSection.html");
190 | break;
191 | case(HELP_PRINT_DIALOG):
192 | url = user_guide_url("ChIOPrintSection.html");
193 | break;
194 | case(HELP_FIND_DIALOG):
195 | url = user_guide_url("ChWorkFindPacketSection.html");
196 | break;
197 | case(HELP_FIREWALL_DIALOG):
198 | url = user_guide_url("ChUseToolsMenuSection.html");
199 | break;
200 | case(HELP_GOTO_DIALOG):
201 | url = user_guide_url("ChWorkGoToPacketSection.html");
202 | break;
203 | case(HELP_CAPTURE_OPTIONS_DIALOG):
204 | url = user_guide_url("ChCapCaptureOptions.html");
205 | break;
206 | case(HELP_CAPTURE_INFO_DIALOG):
207 | url = user_guide_url("ChCapRunningSection.html");
208 | break;
209 | case(HELP_CAPTURE_MANAGE_INTERFACES_DIALOG):
210 | url = user_guide_url("ChCapManageInterfacesSection.html");
211 | break;
212 | case(HELP_ENABLED_PROTOCOLS_DIALOG):
213 | url = user_guide_url("ChCustProtocolDissectionSection.html");
214 | break;
215 | case(HELP_ENABLED_HEURISTICS_DIALOG):
216 | url = user_guide_url("ChCustProtocolDissectionSection.html");
217 | break;
218 | case(HELP_DECODE_AS_DIALOG):
219 | url = user_guide_url("ChCustProtocolDissectionSection.html");
220 | break;
221 | case(HELP_DECODE_AS_SHOW_DIALOG):
222 | url = user_guide_url("ChCustProtocolDissectionSection.html");
223 | break;
224 | case(HELP_FOLLOW_STREAM_DIALOG):
225 | url = user_guide_url("ChAdvFollowStreamSection.html");
226 | break;
227 | case(HELP_SHOW_PACKET_BYTES_DIALOG):
228 | url = user_guide_url("ChAdvShowPacketBytes.html");
229 | break;
230 | case(HELP_EXPERT_INFO_DIALOG):
231 | url = user_guide_url("ChAdvExpert.html");
232 | break;
233 | case(HELP_EXTCAP_OPTIONS_DIALOG):
234 | url = doc_file_url("extcap.html", application_configuration_environment_prefix());
235 | break;
236 | case(HELP_STATS_SUMMARY_DIALOG):
237 | url = user_guide_url("ChStatSummary.html");
238 | break;
239 | case(HELP_STATS_PROTO_HIERARCHY_DIALOG):
240 | url = user_guide_url("ChStatHierarchy.html");
241 | break;
242 | case(HELP_STATS_ENDPOINTS_DIALOG):
243 | url = user_guide_url("ChStatEndpoints.html");
244 | break;
245 | case(HELP_STATS_CONVERSATIONS_DIALOG):
246 | url = user_guide_url("ChStatConversations.html");
247 | break;
248 | case(HELP_STATS_IO_GRAPH_DIALOG):
249 | url = user_guide_url("ChStatIOGraphs.html");
250 | break;
251 | case(HELP_STATS_LTE_MAC_TRAFFIC_DIALOG):
252 | url = user_guide_url("ChTelLTE.html#ChTelLTEMACTraffic");
253 | break;
254 | case(HELP_STATS_LTE_RLC_TRAFFIC_DIALOG):
255 | url = user_guide_url("ChTelLTE.html#ChTelLTERLCTraffic");
256 | break;
257 | case(HELP_STATS_TCP_STREAM_GRAPHS_DIALOG):
258 | url = user_guide_url("ChStatTCPStreamGraphs.html");
259 | break;
260 | case(HELP_STATS_WLAN_TRAFFIC_DIALOG):
261 | url = user_guide_url("ChWirelessWLANTraffic.html");
262 | break;
263 | case(HELP_FILESET_DIALOG):
264 | url = user_guide_url("ChIOFileSetSection.html");
265 | break;
266 | case(HELP_CAPTURE_INTERFACE_OPTIONS_DIALOG):
267 | url = user_guide_url("ChCustPreferencesSection.html#ChCustInterfaceOptionsSection");
268 | break;
269 | case(HELP_PREFERENCES_DIALOG):
270 | url = user_guide_url("ChCustPreferencesSection.html");
271 | break;
272 | case(HELP_EXPORT_FILE_DIALOG):
273 | case(HELP_EXPORT_FILE_WIN32_DIALOG):
274 | url = user_guide_url("ChIOExportSection.html");
275 | break;
276 | case(HELP_EXPORT_BYTES_DIALOG):
277 | url = user_guide_url("ChIOExportSection.html#ChIOExportSelectedDialog");
278 | break;
279 | case(HELP_EXPORT_PDUS_DIALOG):
280 | url = user_guide_url("ChIOExportSection.html#ChIOExportPDUSDialog");
281 | break;
282 | case(HELP_STRIP_HEADERS_DIALOG):
283 | url = user_guide_url("ChIOExportSection.html#ChIOStripHeadersDialog");
284 | break;
285 | case(HELP_EXPORT_OBJECT_LIST):
286 | url = user_guide_url("ChIOExportSection.html#ChIOExportObjectsDialog");
287 | break;
288 | case(HELP_OPEN_DIALOG):
289 | case(HELP_OPEN_WIN32_DIALOG):
290 | url = user_guide_url("ChIOOpenSection.html");
291 | break;
292 | case(HELP_MERGE_DIALOG):
293 | case(HELP_MERGE_WIN32_DIALOG):
294 | url = user_guide_url("ChIOMergeSection.html");
295 | break;
296 | case(HELP_IMPORT_DIALOG):
297 | url = user_guide_url("ChIOImportSection.html");
298 | break;
299 | case(HELP_SAVE_DIALOG):
300 | case(HELP_SAVE_WIN32_DIALOG):
301 | url = user_guide_url("ChIOSaveSection.html");
302 | break;
303 | case(HELP_TIME_SHIFT_DIALOG):
304 | url = user_guide_url("ChWorkShiftTimePacketSection.html");
305 | break;
306 | case(HELP_TELEPHONY_VOIP_CALLS_DIALOG):
307 | url = user_guide_url("ChTelVoipCalls.html");
308 | break;
309 | case(HELP_TELEPHONY_RTP_ANALYSIS_DIALOG):
310 | url = user_guide_url("ChTelRTP.html#ChTelRTPAnalysis");
311 | break;
312 | case(HELP_TELEPHONY_RTP_STREAMS_DIALOG):
313 | url = user_guide_url("ChTelRTP.html#ChTelRTPStreams");
314 | break;
315 | case(HELP_NEW_PACKET_DIALOG):
316 | url = user_guide_url("ChapterWork.html#ChWorkPacketSepView");
317 | break;
318 | case(HELP_IAX2_ANALYSIS_DIALOG):
319 | url = user_guide_url("ChTelIAX2Analysis.html");
320 | break;
321 | case(HELP_TELEPHONY_RTP_PLAYER_DIALOG):
322 | url = user_guide_url("ChTelRTP.html#ChTelRtpPlayer");
323 | break;
324 | case(HELP_STAT_FLOW_GRAPH):
325 | url = user_guide_url("ChStatFlowGraph.html");
326 | break;
327 | case(HELP_STATS_PLOT_DIALOG):
328 | url = user_guide_url("ChStatPlots.html");
329 | break;
330 |
331 | case(TOPIC_ACTION_NONE):
332 | default:
333 | url = g_strdup(WS_HOME_PAGE_URL)g_strdup_inline ("https://www.wireshark.org");
| Value stored to 'url' is never read
334 | ws_assert_not_reached()ws_log_fatal_full("", LOG_LEVEL_ERROR, "ui/help_url.c", 334, __func__ , "assertion \"not reached\" failed");
335 | }
336 |
337 | return url;
338 | }