diff options
author | Stanislav Malyshev <stas@php.net> | 2007-02-16 18:24:16 +0000 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2007-02-16 18:24:16 +0000 |
commit | f1728950fe5fa98f142f64722e1674507cefe8ba (patch) | |
tree | 12c4d846c0e6cf3e2c1c2309897e536c9836073d /ext/calendar | |
parent | 624dd135a8159ecea9e214f7bb0c36a32eb37624 (diff) | |
download | php-git-f1728950fe5fa98f142f64722e1674507cefe8ba.tar.gz |
increase hebdate buffer, use snprintf
Diffstat (limited to 'ext/calendar')
-rw-r--r-- | ext/calendar/calendar.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c index 844aaf9b40..b151ad3f20 100644 --- a/ext/calendar/calendar.c +++ b/ext/calendar/calendar.c @@ -416,7 +416,7 @@ PHP_FUNCTION(cal_from_jd) calendar->from_jd(jd, &year, &month, &day); - sprintf(date, "%i/%i/%i", month, day, year); + snprintf(date, sizeof(date)-1, "%i/%i/%i", month, day, year); add_assoc_string(return_value, "date", date, 1); add_assoc_long(return_value, "month", month); @@ -447,7 +447,7 @@ PHP_FUNCTION(jdtogregorian) } SdnToGregorian(julday, &year, &month, &day); - sprintf(date, "%i/%i/%i", month, day, year); + snprintf(date, sizeof(date)-1, "%i/%i/%i", month, day, year); RETURN_STRING(date, 1); } @@ -480,7 +480,7 @@ PHP_FUNCTION(jdtojulian) } SdnToJulian(julday, &year, &month, &day); - sprintf(date, "%i/%i/%i", month, day, year); + snprintf(date, sizeof(date)-1, "%i/%i/%i", month, day, year); RETURN_STRING(date, 1); } @@ -602,7 +602,7 @@ PHP_FUNCTION(jdtojewish) long julday, fl = 0; zend_bool heb = 0; int year, month, day; - char date[16], hebdate[25]; + char date[16], hebdate[32]; char *dayp, *yearp; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|bl", &julday, &heb, &fl) == FAILURE) { @@ -611,7 +611,7 @@ PHP_FUNCTION(jdtojewish) SdnToJewish(julday, &year, &month, &day); if (!heb) { - sprintf(date, "%i/%i/%i", month, day, year); + snprintf(date, sizeof(date)-1, "%i/%i/%i", month, day, year); RETURN_STRING(date, 1); } else { if (year <= 0 || year > 9999) { @@ -619,7 +619,7 @@ PHP_FUNCTION(jdtojewish) RETURN_FALSE; } - sprintf(hebdate, "%s %s %s", heb_number_to_chars(day, fl, &dayp), JewishMonthHebName[month], heb_number_to_chars(year, fl, &yearp)); + snprintf(hebdate, sizeof(hebdate)-1, "%s %s %s", heb_number_to_chars(day, fl, &dayp), JewishMonthHebName[month], heb_number_to_chars(year, fl, &yearp)); if (dayp) { efree(dayp); @@ -661,7 +661,7 @@ PHP_FUNCTION(jdtofrench) } SdnToFrench(julday, &year, &month, &day); - sprintf(date, "%i/%i/%i", month, day, year); + snprintf(date, sizeof(date)-1, "%i/%i/%i", month, day, year); RETURN_STRING(date, 1); } |