| 287 | static char *mark; // holds previous terminator (generally) |
| 288 | |
| 289 | boolean |
| 290 | submit_web_report(int cos, const char *msg, const char *why) |
| 291 | { |
| 292 | urem = (gc.crash_urlmax < 0 || gc.crash_urlmax > MAX_URL) |
| 293 | ? MAX_URL : min(MAX_URL,gc.crash_urlmax); |
| 294 | char temp[200]; |
| 295 | char temp2[200]; |
| 296 | int countpp = 0; /* pre and post traceback lines */ |
| 297 | // URL loaded for creating reports to the NetHack DevTeam |
| 298 | // CRASHREPORTURL=https://nethack.org/links/cr-5.0.0.html |
| 299 | if (!sysopt.crashreporturl) |
| 300 | return FALSE; |
| 301 | SWR_ADD(sysopt.crashreporturl); |
| 302 | /* |
| 303 | * Note: all snprintf() calls here changed to sprintf() to avoid |
| 304 | * complaints from static analyzer. All but one were unnecessary |
| 305 | * since they were formatting int or unsigned into a large buffer. |
| 306 | */ |
| 307 | /* cos - operation, v - version */ |
| 308 | Sprintf(temp, "?cos=%d&v=1", cos); |
| 309 | SWR_ADD(temp); |
| 310 | |
| 311 | /* msg==NULL for #bugreport */ |
| 312 | if (msg) { |
| 313 | SWR_ADD("&subject="); |
| 314 | Sprintf(temp, "%.40s report for NetHack %.40s", |
| 315 | msg, version_string(temp2, sizeof temp2 )); |
| 316 | SWR_ADD_URIcoded(temp); |
| 317 | } |
| 318 | |
| 319 | SWR_ADD("&gitver="); |
| 320 | SWR_ADD_URIcoded(getversionstring(temp2, sizeof temp2)); |
| 321 | |
| 322 | if (gc.crash_name) { |
| 323 | SWR_ADD("&name="); |
| 324 | SWR_ADD_URIcoded(gc.crash_name); |
| 325 | } |
| 326 | |
| 327 | if(gc.crash_email) { |
| 328 | SWR_ADD("&email="); |
| 329 | SWR_ADD_URIcoded(gc.crash_email); |
| 330 | } |
| 331 | // hardware: leave for user |
| 332 | // software: leave for user |
| 333 | // comments: leave for user |
| 334 | |
| 335 | SWR_ADD("&details="); |
| 336 | if (why) { |
| 337 | SWR_ADD_URIcoded(why); |
| 338 | SWR_ADD_URIcoded("\n"); |
| 339 | mark = uend; |
| 340 | countpp++; |
| 341 | } |
| 342 | |
| 343 | SWR_ADD_URIcoded("bid: "); |
| 344 | SWR_ADD_URIcoded(bid); |
| 345 | SWR_ADD_URIcoded("\n"); |
| 346 | mark = uend; |
no test coverage detected