The following issues were found

lib/warnless.c
1 issues
read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 367 Column: 19 CWE codes: 120 20

              
ssize_t curlx_read(int fd, void *buf, size_t count)
{
  return (ssize_t)read(fd, buf, curlx_uztoui(count));
}

ssize_t curlx_write(int fd, const void *buf, size_t count)
{
  return (ssize_t)write(fd, buf, curlx_uztoui(count));

            

Reported by FlawFinder.

lib/dict.c
1 issues
strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 149 Column: 15 CWE codes: 126

                  return CURLE_OUT_OF_MEMORY; /* failure */

  bytes_written = 0;
  write_len = strlen(s);
  sptr = s;

  for(;;) {
    /* Write the buffer to the socket */
    result = Curl_write(data, sockfd, sptr, write_len, &bytes_written);

            

Reported by FlawFinder.

lib/curl_threads.h
1 issues
InitializeCriticalSection - Exceptions can be thrown in low-memory situations
Security

Line: 43 Column: 34 CWE codes:
Suggestion: Use InitializeCriticalSectionAndSpinCount instead

              #  if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_VISTA) || \
      (_WIN32_WINNT < _WIN32_WINNT_VISTA) || \
      (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
#    define Curl_mutex_init(m)   InitializeCriticalSection(m)
#  else
#    define Curl_mutex_init(m)   InitializeCriticalSectionEx(m, 0, 1)
#  endif
#  define Curl_mutex_acquire(m)  EnterCriticalSection(m)
#  define Curl_mutex_release(m)  LeaveCriticalSection(m)

            

Reported by FlawFinder.

lib/curl_setup_once.h
1 issues
read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 124 Column: 31 CWE codes: 120 20

              
#if defined(__minix)
/* Minix doesn't support recv on TCP sockets */
#define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \
                                   (RECV_TYPE_ARG2)(y), \
                                   (RECV_TYPE_ARG3)(z))

#elif defined(HAVE_RECV)
/*

            

Reported by FlawFinder.

src/macos/src/macos_main.cpp
1 issues
There is an unknown macro here somewhere. Configuration is required. If DECLARE_MAIN is a macro then please configure it.
Error

Line: 25

              
/* ========================================================================= */

DECLARE_MAIN(curl)

REGISTER_MAIN_START
REGISTER_MAIN(curl)
REGISTER_MAIN_END


            

Reported by Cppcheck.

lib/curl_sasl.c
1 issues
strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 478 Column: 8 CWE codes: 126

                    result = build_message(data, &resp);

    if(sasl->params->maxirlen &&
       strlen(mech) + Curl_bufref_len(&resp) > sasl->params->maxirlen)
      Curl_bufref_free(&resp);

    if(!result)
      result = sasl->params->sendauth(data, conn, mech,
                                      (const char *) Curl_bufref_ptr(&resp));

            

Reported by FlawFinder.

lib/curl_gssapi.c
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 125 Column: 3 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              void Curl_gss_log_error(struct Curl_easy *data, const char *prefix,
                        OM_uint32 major, OM_uint32 minor)
{
  char buf[GSS_LOG_BUFFER_LEN];
  size_t len = 0;

  if(major != GSS_S_FAILURE)
    len = display_gss_error(major, GSS_C_GSS_CODE, buf, len);


            

Reported by FlawFinder.

src/tool_cb_rea.c
1 issues
read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 43 Column: 8 CWE codes: 120 20

                ssize_t rc;
  struct InStruct *in = userdata;

  rc = read(in->fd, buffer, sz*nmemb);
  if(rc < 0) {
    if(errno == EAGAIN) {
      errno = 0;
      in->config->readbusy = TRUE;
      return CURL_READFUNC_PAUSE;

            

Reported by FlawFinder.

tests/unit/unit1399.c
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 65 Column: 3 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              
static void expect_timer_seconds(struct Curl_easy *data, int seconds)
{
  char msg[64];
  msnprintf(msg, sizeof(msg), "about %d seconds should have passed", seconds);
  fail_unless(usec_matches_seconds(data->progress.t_nslookup, seconds), msg);
  fail_unless(usec_matches_seconds(data->progress.t_connect, seconds), msg);
  fail_unless(usec_matches_seconds(data->progress.t_appconnect, seconds), msg);
  fail_unless(usec_matches_seconds(data->progress.t_pretransfer, seconds),

            

Reported by FlawFinder.

lib/curl_get_line.c
1 issues
strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 43 Column: 21 CWE codes: 126

                while(1) {
    char *b = fgets(buf, len, input);
    if(b) {
      size_t rlen = strlen(b);
      if(rlen && (b[rlen-1] == '\n')) {
        if(partial) {
          partial = FALSE;
          continue;
        }

            

Reported by FlawFinder.