Changeset 34 for trunk/src/sh_mail.c
- Timestamp:
- May 19, 2006, 8:09:51 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_mail.c
r22 r34 173 173 /* get signature and number 174 174 */ 175 (void) sh_unix_getline (fd, key, (int) ( sizeof(key)-1));175 (void) sh_unix_getline (fd, key, (int)sizeof(key)); 176 176 key[KEY_LEN] = '\0'; 177 177 178 (void) sh_unix_getline (fd, number, (int) (sizeof(number)-1));178 (void) sh_unix_getline (fd, number, (int)sizeof(number)); 179 179 number[(2*SH_MINIBUF) - 2] = '\0'; 180 180 numsig = atol (number); … … 742 742 static char * sh_mail_realloc (char * inbuf, size_t * insize, size_t increase) 743 743 { 744 size_t newsize = (*insize) + increase + 1;745 char * outbuf ;744 size_t newsize; 745 char * outbuf = inbuf; 746 746 747 747 SL_ENTER(_("sh_mail_realloc")); 748 748 749 outbuf = SH_ALLOC(newsize); 750 MLOCK(outbuf, newsize); 751 (void) sl_strlcpy(outbuf, inbuf, newsize); 752 753 memset (inbuf, 0, (*insize)); 754 MUNLOCK(inbuf, (*insize)); 755 SH_FREE(inbuf); 756 757 *insize = newsize; 749 if (sl_ok_adds((*insize), 1)) 750 { 751 newsize = (*insize) + 1; 752 753 if (sl_ok_adds(newsize, increase)) 754 { 755 newsize += increase; 756 757 outbuf = SH_ALLOC(newsize); 758 MLOCK(outbuf, newsize); 759 (void) sl_strlcpy(outbuf, inbuf, newsize); 760 761 memset (inbuf, 0, (*insize)); 762 MUNLOCK(inbuf, (*insize)); 763 SH_FREE(inbuf); 764 765 *insize = newsize; 766 } 767 } 758 768 759 769 SL_RETURN( (outbuf), _("sh_mail_realloc")); … … 1227 1237 int sh_mail_set_relay (const char * str_s) 1228 1238 { 1229 size_t i = 0;1230 1231 1239 SL_ENTER(_("sh_mail_set_relay")); 1232 1240 … … 1235 1243 1236 1244 if (relay_host != NULL) 1237 SH_FREE (relay_host); 1245 { 1246 SH_FREE (relay_host); 1247 relay_host = NULL; 1248 } 1238 1249 1239 1250 if (0 == sl_strncmp(str_s, _("NULL"), 4)) 1240 1251 { 1241 relay_host = NULL;1242 1252 SL_RETURN( 0, _("sh_mail_set_relay")); 1243 1253 } 1244 1254 1245 i = sl_strlen(str_s) + 1; 1246 relay_host = SH_ALLOC (i); 1247 if (relay_host != NULL) 1248 (void) sl_strlcpy(relay_host, str_s, i); 1249 else 1250 fprintf(stderr, _("ERROR: sh_mail_set_relay: Out of memory")); 1255 relay_host = sh_util_strdup(str_s); 1256 1251 1257 SL_RETURN( 0, _("sh_mail_set_relay")); 1252 1258 } … … 1802 1808 return NULL; 1803 1809 1804 size = strlen(str); 1805 /* fprintf(stderr, "orig = %d\n", size); */ 1810 size = strlen(str) + 1; 1806 1811 blocks = 1 + (size / SPLIT_AT); 1807 1812 1808 size = size + (2*blocks) + 1; 1813 if (sl_ok_muls(2, blocks) && sl_ok_adds(size, (2*blocks))) 1814 { 1815 size = size + (2*blocks); 1816 } 1817 else 1818 { 1819 /* integer overflow, do not split */ 1820 p = sh_util_strdup(str); 1821 return p; 1822 } 1823 1809 1824 p = SH_ALLOC(size); 1810 1825 memset(p, 0, size); 1811 /* fprintf(stderr, "alloc = %d\n", size); */ 1826 1812 1827 p0 = p; 1813 1828 … … 1897 1912 unsigned char * comp_dn, * eom; 1898 1913 HEADER * header; 1899 int count, index, type, rdlength, pref; 1914 int type, rdlength, pref; 1915 unsigned int count, index; 1900 1916 dnsrep * retval; 1901 1917 … … 1978 1994 /* allocate space for the results */ 1979 1995 1996 if (!sl_ok_muls(count, sizeof (mx))) 1997 { 1998 SH_FREE (retval); 1999 SL_RETURN (NULL, _("get_mx")); 2000 } 2001 1980 2002 result = SH_ALLOC (count * sizeof (mx)); 2003 1981 2004 if (!result) 1982 2005 {
Note:
See TracChangeset
for help on using the changeset viewer.