### Bug Summary

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