Differences

This shows you the differences between two versions of the page.

Link to this comparison view

people:solar:software:public-domain-source-code:concat [2016/07/22 22:40]
solar Use size_t for variables holding strlen() return values
people:solar:software:public-domain-source-code:concat [2017/11/15 23:18] (current)
solar dropped the popa3d reference
Line 19: Line 19:
  * Written by Solar Designer <solar at openwall.com>​ and placed in the  * Written by Solar Designer <solar at openwall.com>​ and placed in the
  * public domain.  * public domain.
- * 
- * Originally written for and currently maintained as a part of popa3d, 
- * a POP3 server: 
- * 
- ​* http://​www.openwall.com/​popa3d/​ 
  */  */
  
Line 42: Line 37:
  while ((s = va_arg(args,​ char *))) {  while ((s = va_arg(args,​ char *))) {
  l = strlen(s);  l = strlen(s);
- if ((m += l) < l) break;+ if ((m += l) < l) 
 + break;
  }  }
  va_end(args);​  va_end(args);​
- if (s || m >= INT_MAX) return NULL;+ if (s || m >= INT_MAX) 
 + return NULL;
  
  result = (char *)malloc(m + 1);  result = (char *)malloc(m + 1);
- if (!result) return NULL;+ if (!result) 
 + return NULL;
  
  memcpy(p = result, s1, n);  memcpy(p = result, s1, n);
Line 55: Line 53:
  while ((s = va_arg(args,​ char *))) {  while ((s = va_arg(args,​ char *))) {
  l = strlen(s);  l = strlen(s);
- if ((n += l) < l || n > m) break;+ if ((n += l) < l || n > m) 
 + break;
  memcpy(p, s, l);  memcpy(p, s, l);
  p += l;  p += l;
people/solar/software/public-domain-source-code/concat.1469220042.txt · Last modified: 2016/07/22 22:40 by solar
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate to DokuWiki Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki Powered by OpenVZ Powered by Openwall GNU/*/Linux