Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam

Webinar: Evaluation - 05.12

>
>
>
Examples of errors detected by the V527…

Examples of errors detected by the V527 diagnostic

V527. The 'zero' value is assigned to pointer. Probably meant: *ptr = zero.


PNG library

V527 It is odd that the '\0' value is assigned to 'char' type pointer. Probably meant: *new_key [79] = '\0'. graphics3D pngwutil.c 1283


png_size_t /* PRIVATE */
png_check_keyword(png_structp png_ptr, png_charp key,
                  png_charpp new_key)
{
  ....
  if (key_len > 79)
  {
    png_warning(png_ptr,
                "keyword length must be 1 - 79 characters");
    new_key[79] = '\0';
    key_len = 79;
  }
  ....
}

This is what should have been written here: (*new_key)[79] = '\0';


Apache HTTP Server

V527 It is odd that the '\0' value is assigned to 'char' type pointer. Probably meant: *tag->arg = '\0'. mod_headers mod_headers.c 330


typedef struct {
    const char* (*func)(request_rec *r,char *arg);
    char *arg;
} format_tag;

static char *parse_format_tag(apr_pool_t *p,
                              format_tag *tag,
                              const char **sa)
{
  ....
  tag->arg = '\0';
  ....
}

This is what should have been written here: tag->arg = NULL; or tag->arg[0] = '\0';.


ReactOS

V527 It is odd that the L'\0' value is assigned to 'wchar_t' type pointer. Probably meant: *lpBackSlash = L'\0'. desk screensaver.c 453


static VOID
AddScreenSavers(HWND hwndDlg, PDATA pData)
{
  ....
  LPTSTR lpBackSlash;
  lpBackSlash = _tcsrchr(szSearchPath, _T('\\'));
  if (lpBackSlash != NULL)
  {
    lpBackSlash = '\0';
    SearchScreenSavers(hwndScreenSavers, szSearchPath, pData);
  }
}

The programmer simply zeroed the IpBackSlash pointer instead of throwing off everything after the last \ character. This is what should have been written here: *lpBackSlash = '\0';


Trans-Proteomic Pipeline

V527 It is odd that the '\0' value is assigned to 'char' type pointer. Probably meant: *pEndAttrValue = '\0'. tpplib ramp.cpp 1856


RAMPREAL *readPeaks(RAMPFILE *pFI,
      ramp_fileoffset_t lScanIndex)
{
  ....
  else
  {
    const char* pEndAttrValue;
    pEndAttrValue =
      strchr(pBeginData + strlen("contentType=\"") + 1, '\"');
    pEndAttrValue  = '\0';
    fprintf(stderr, "%s Unsupported content type\n",
            pBeginData);
    return NULL;
  }
  ....
}

This is what should have been written here: *pEndAttrValue = '\0';

Similar errors can be found in some other places:

  • V527 It is odd that the '\0' value is assigned to 'char' type pointer. Probably meant: *pEndAttrValue = '\0'. tpplib ramp.cpp 1875
  • V527 It is odd that the '\0' value is assigned to 'char' type pointer. Probably meant: *pEndAttrValue = '\0'. spectrast spectrast_ramp.cpp 1844
  • V527 It is odd that the '\0' value is assigned to 'char' type pointer. Probably meant: *pEndAttrValue = '\0'. spectrast spectrast_ramp.cpp 1863

Scilab

V527 It is odd that the '\0' value is assigned to 'char' type pointer. Probably meant: *last = '\0'. getenvb.c 24


void GetenvB(char *name, char *env, int len)
{
  int ierr = 0, one = 1;
  C2F(getenvc)(&ierr,name,env,&len,&one);
  if (ierr == 0)
  {
    char *last = &env[len-1];
    while ( *last == ' ' ) { last = '\0' ; }
    last--;
  }
  ....
}

Most likely this is what should be written here: while ( *last == ' ' ) { *last++ = '\0' ; }


Haiku Operation System

V527 It is odd that the '\0' value is assigned to 'char' type pointer. Probably meant: *scratchPtr = '\0'. TextGapBuffer.cpp 228


const char*
TextGapBuffer::Text()
{
  const char* realText = RealText();

  if (fPasswordMode) {
    ....

    char* scratchPtr = fScratchBuffer;
    for (uint32 i = 0; i < numChars; i++) {
      memcpy(scratchPtr, B_UTF8_BULLET, bulletCharLen);
      scratchPtr += bulletCharLen;
    }
    scratchPtr = '\0';      // <=

    return fScratchBuffer;
  }

  return realText;
}

Tizen

V527 It is odd that the '\0' value is assigned to 'char' type pointer. Probably meant: *body[new_len] = '\0'. http_request.c 370


int _read_request_body(...., char **body)
{
  ....
  *body = realloc(*body, new_len + 1);
  ....
  memcpy(*body + curr_len, ptr, body_size);
  body[new_len] = '\0';                        // <=
  curr_len = new_len;
  ....
}

This is what should have been written here: (*body)[new_len] = '\0';