Bug Summary

File:version.c
Location:line 90, column 3
Description:Value stored to 'ptr' is never read

Annotated Source Code

1/***************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
7 *
8 * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
9 *
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at http://curl.haxx.se/docs/copyright.html.
13 *
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 ***************************************************************************/
22
23#include "curl_setup.h"
24
25#include <curl/curl.h>
26#include "urldata.h"
27#include "vtls/vtls.h"
28#include "http2.h"
29
30#define _MPRINTF_REPLACE /* use the internal *printf() functions */
31#include <curl/mprintf.h>
32
33#ifdef USE_ARES
34# if defined(CURL_STATICLIB) && !defined(CARES_STATICLIB) && \
35 (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__))
36# define CARES_STATICLIB
37# endif
38# include <ares.h>
39#endif
40
41#ifdef USE_LIBIDN
42#include <stringprep.h>
43#endif
44
45#if defined(HAVE_ICONV) && defined(CURL_DOES_CONVERSIONS)
46#include <iconv.h>
47#endif
48
49#ifdef USE_LIBRTMP
50#include <librtmp/rtmp.h>
51#endif
52
53#ifdef USE_LIBSSH2
54#include <libssh2.h>
55#endif
56
57#ifdef HAVE_LIBSSH2_VERSION
58/* get it run-time if possible */
59#define CURL_LIBSSH2_VERSIONLIBSSH2_VERSION libssh2_version(0)
60#else
61/* use build-time if run-time not possible */
62#define CURL_LIBSSH2_VERSIONLIBSSH2_VERSION LIBSSH2_VERSION
63#endif
64
65char *curl_version(void)
66{
67 static char version[200];
68 char *ptr = version;
69 size_t len;
70 size_t left = sizeof(version);
71
72 strcpy(ptr, LIBCURL_NAME "/" LIBCURL_VERSION)((__builtin_object_size (ptr, 0) != (size_t) -1) ? __builtin___strcpy_chk
(ptr, "libcurl" "/" "7.37.0-DEV", __builtin_object_size (ptr
, 2 > 1)) : __inline_strcpy_chk (ptr, "libcurl" "/" "7.37.0-DEV"
))
;
73 len = strlen(ptr);
74 left -= len;
75 ptr += len;
76
77 if(left > 1) {
78 len = Curl_ssl_version(ptr + 1, left - 1);
79
80 if(len > 0) {
81 *ptr = ' ';
82 left -= ++len;
83 ptr += len;
84 }
85 }
86
87#ifdef HAVE_LIBZ1
88 len = snprintfcurl_msnprintf(ptr, left, " zlib/%s", zlibVersion());
89 left -= len;
90 ptr += len;
Value stored to 'ptr' is never read
91#endif
92#ifdef USE_ARES
93 /* this function is only present in c-ares, not in the original ares */
94 len = snprintfcurl_msnprintf(ptr, left, " c-ares/%s", ares_version(NULL((void*)0)));
95 left -= len;
96 ptr += len;
97#endif
98#ifdef USE_LIBIDN
99 if(stringprep_check_version(LIBIDN_REQUIRED_VERSION"0.4.1")) {
100 len = snprintfcurl_msnprintf(ptr, left, " libidn/%s", stringprep_check_version(NULL((void*)0)));
101 left -= len;
102 ptr += len;
103 }
104#endif
105#ifdef USE_WIN32_IDN
106 len = snprintfcurl_msnprintf(ptr, left, " WinIDN");
107 left -= len;
108 ptr += len;
109#endif
110#if defined(HAVE_ICONV) && defined(CURL_DOES_CONVERSIONS)
111#ifdef _LIBICONV_VERSION
112 len = snprintfcurl_msnprintf(ptr, left, " iconv/%d.%d",
113 _LIBICONV_VERSION >> 8, _LIBICONV_VERSION & 255);
114#else
115 /* version unknown */
116 len = snprintfcurl_msnprintf(ptr, left, " iconv");
117#endif /* _LIBICONV_VERSION */
118 left -= len;
119 ptr += len;
120#endif
121#ifdef USE_LIBSSH2
122 len = snprintfcurl_msnprintf(ptr, left, " libssh2/%s", CURL_LIBSSH2_VERSIONLIBSSH2_VERSION);
123 left -= len;
124 ptr += len;
125#endif
126#ifdef USE_NGHTTP2
127 len = Curl_http2_ver(ptr, left);
128 left -= len;
129 ptr += len;
130#endif
131#ifdef USE_LIBRTMP
132 {
133 char suff[2];
134 if(RTMP_LIB_VERSION & 0xff) {
135 suff[0] = (RTMP_LIB_VERSION & 0xff) + 'a' - 1;
136 suff[1] = '\0';
137 }
138 else
139 suff[0] = '\0';
140
141 snprintfcurl_msnprintf(ptr, left, " librtmp/%d.%d%s",
142 RTMP_LIB_VERSION >> 16, (RTMP_LIB_VERSION >> 8) & 0xff,
143 suff);
144/*
145 If another lib version is added below this one, this code would
146 also have to do:
147
148 len = what snprintf() returned
149
150 left -= len;
151 ptr += len;
152*/
153 }
154#endif
155
156 return version;
157}
158
159/* data for curl_version_info
160
161 Keep the list sorted alphabetically. It is also written so that each
162 protocol line has its own #if line to make things easier on the eye.
163 */
164
165static const char * const protocols[] = {
166#ifndef CURL_DISABLE_DICT
167 "dict",
168#endif
169#ifndef CURL_DISABLE_FILE
170 "file",
171#endif
172#ifndef CURL_DISABLE_FTP
173 "ftp",
174#endif
175#if defined(USE_SSL) && !defined(CURL_DISABLE_FTP)
176 "ftps",
177#endif
178#ifndef CURL_DISABLE_GOPHER
179 "gopher",
180#endif
181#ifndef CURL_DISABLE_HTTP
182 "http",
183#endif
184#if defined(USE_SSL) && !defined(CURL_DISABLE_HTTP)
185 "https",
186#endif
187#ifndef CURL_DISABLE_IMAP
188 "imap",
189#endif
190#if defined(USE_SSL) && !defined(CURL_DISABLE_IMAP)
191 "imaps",
192#endif
193#ifndef CURL_DISABLE_LDAP
194 "ldap",
195#if !defined(CURL_DISABLE_LDAPS) && \
196 ((defined(USE_OPENLDAP) && defined(USE_SSL)) || \
197 (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL1)))
198 "ldaps",
199#endif
200#endif
201#ifndef CURL_DISABLE_POP3
202 "pop3",
203#endif
204#if defined(USE_SSL) && !defined(CURL_DISABLE_POP3)
205 "pop3s",
206#endif
207#ifdef USE_LIBRTMP
208 "rtmp",
209#endif
210#ifndef CURL_DISABLE_RTSP
211 "rtsp",
212#endif
213#ifdef USE_LIBSSH2
214 "scp",
215#endif
216#ifdef USE_LIBSSH2
217 "sftp",
218#endif
219#ifndef CURL_DISABLE_SMTP
220 "smtp",
221#endif
222#if defined(USE_SSL) && !defined(CURL_DISABLE_SMTP)
223 "smtps",
224#endif
225#ifndef CURL_DISABLE_TELNET
226 "telnet",
227#endif
228#ifndef CURL_DISABLE_TFTP
229 "tftp",
230#endif
231
232 NULL((void*)0)
233};
234
235static curl_version_info_data version_info = {
236 CURLVERSION_NOWCURLVERSION_FOURTH,
237 LIBCURL_VERSION"7.37.0-DEV",
238 LIBCURL_VERSION_NUM0x072500,
239 OS"x86_64-apple-darwin12.5.0", /* as found by configure or set by hand at build-time */
240 0 /* features is 0 by default */
241#ifdef ENABLE_IPV61
242 | CURL_VERSION_IPV6(1<<0)
243#endif
244#ifdef USE_SSL
245 | CURL_VERSION_SSL(1<<2)
246#endif
247#ifdef USE_NTLM
248 | CURL_VERSION_NTLM(1<<4)
249#endif
250#if defined(USE_NTLM) && defined(NTLM_WB_ENABLED1)
251 | CURL_VERSION_NTLM_WB(1<<15)
252#endif
253#ifdef USE_WINDOWS_SSPI
254 | CURL_VERSION_SSPI(1<<11)
255#endif
256#ifdef HAVE_LIBZ1
257 | CURL_VERSION_LIBZ(1<<3)
258#endif
259#ifdef USE_HTTP_NEGOTIATE
260 | CURL_VERSION_GSSNEGOTIATE(1<<5)
261#endif
262#ifdef DEBUGBUILD
263 | CURL_VERSION_DEBUG(1<<6)
264#endif
265#ifdef CURLDEBUG
266 | CURL_VERSION_CURLDEBUG(1<<13)
267#endif
268#ifdef CURLRES_ASYNCH
269 | CURL_VERSION_ASYNCHDNS(1<<7)
270#endif
271#ifdef HAVE_SPNEGO
272 | CURL_VERSION_SPNEGO(1<<8)
273#endif
274#if (CURL_SIZEOF_CURL_OFF_T8 > 4) && \
275 ( (SIZEOF_OFF_T8 > 4) || defined(USE_WIN32_LARGE_FILES) )
276 | CURL_VERSION_LARGEFILE(1<<9)
277#endif
278#if defined(CURL_DOES_CONVERSIONS)
279 | CURL_VERSION_CONV(1<<12)
280#endif
281#if defined(USE_TLS_SRP)
282 | CURL_VERSION_TLSAUTH_SRP(1<<14)
283#endif
284#if defined(USE_NGHTTP2)
285 | CURL_VERSION_HTTP2(1<<16)
286#endif
287 ,
288 NULL((void*)0), /* ssl_version */
289 0, /* ssl_version_num, this is kept at zero */
290 NULL((void*)0), /* zlib_version */
291 protocols,
292 NULL((void*)0), /* c-ares version */
293 0, /* c-ares version numerical */
294 NULL((void*)0), /* libidn version */
295 0, /* iconv version */
296 NULL((void*)0), /* ssh lib version */
297};
298
299curl_version_info_data *curl_version_info(CURLversion stamp)
300{
301#ifdef USE_LIBSSH2
302 static char ssh_buffer[80];
303#endif
304
305#ifdef USE_SSL
306 static char ssl_buffer[80];
307 Curl_ssl_version(ssl_buffer, sizeof(ssl_buffer));
308 version_info.ssl_version = ssl_buffer;
309#endif
310
311#ifdef HAVE_LIBZ1
312 version_info.libz_version = zlibVersion();
313 /* libz left NULL if non-existing */
314#endif
315#ifdef USE_ARES
316 {
317 int aresnum;
318 version_info.ares = ares_version(&aresnum);
319 version_info.ares_num = aresnum;
320 }
321#endif
322#ifdef USE_LIBIDN
323 /* This returns a version string if we use the given version or later,
324 otherwise it returns NULL */
325 version_info.libidn = stringprep_check_version(LIBIDN_REQUIRED_VERSION"0.4.1");
326 if(version_info.libidn)
327 version_info.features |= CURL_VERSION_IDN(1<<10);
328#elif defined(USE_WIN32_IDN)
329 version_info.features |= CURL_VERSION_IDN(1<<10);
330#endif
331
332#if defined(HAVE_ICONV) && defined(CURL_DOES_CONVERSIONS)
333#ifdef _LIBICONV_VERSION
334 version_info.iconv_ver_num = _LIBICONV_VERSION;
335#else
336 /* version unknown */
337 version_info.iconv_ver_num = -1;
338#endif /* _LIBICONV_VERSION */
339#endif
340
341#ifdef USE_LIBSSH2
342 snprintfcurl_msnprintf(ssh_buffer, sizeof(ssh_buffer), "libssh2/%s", LIBSSH2_VERSION);
343 version_info.libssh_version = ssh_buffer;
344#endif
345
346 (void)stamp; /* avoid compiler warnings, we don't use this */
347
348 return &version_info;
349}