title: memset() causing data abort
body: <p>I'm getting some strange, intermittent, data aborts (&lt; 5% of the time) in some of my code, when calling <code>memset()</code>.  The problem is that is usually doesn't happen unless the code is running for a couple days, so it's hard to catch it in the act.</p>
  
  <p>I'm using the following code:</p>
  
  <pre><code>char *msg = (char*)malloc(sizeof(char)*2048);
  char *temp = (char*)malloc(sizeof(char)*1024);
  memset(msg, 0, 2048);
  memset(temp, 0, 1024);
  char *tempstr = (char*)malloc(sizeof(char)*128);
  
  sprintf(temp, "%s %s/%s %s%s", EZMPPOST, EZMPTAG, EZMPVER, TYPETXT, EOL);
  strcat(msg, temp);
  
  //Add Data
  memset(tempstr, '\0', 128);
  wcstombs(tempstr, gdevID, wcslen(gdevID));
  sprintf(temp, "%s: %s%s", "DeviceID", tempstr, EOL);
  strcat(msg, temp);
  </code></pre>
  
  <p>As you can see, I'm not trying to use memset with a size larger that what's originally allocated with <code>malloc()</code></p>
  
  <p>Anyone see what might be wrong with this?</p>