From: <rl...@us...> - 2006-05-02 01:50:05
|
Revision: 16123 Author: rlaager Date: 2006-05-01 18:49:54 -0700 (Mon, 01 May 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16123&view=rev Log Message: ----------- Fix a bug reported as SF Patch #1479875. "in gaim_icqinfo() in oscar.c , the struct tm used for filling in birthday date is not initialized, this cause crash in strftime on amd64 which is indirectly called by gaim_date_format_short. Reproduced on debian sarge amd64 stable." I chose a different solution than what was provided in the patch. Modified Paths: -------------- trunk/src/protocols/oscar/oscar.c Modified: trunk/src/protocols/oscar/oscar.c =================================================================== --- trunk/src/protocols/oscar/oscar.c 2006-05-02 01:44:14 UTC (rev 16122) +++ trunk/src/protocols/oscar/oscar.c 2006-05-02 01:49:54 UTC (rev 16123) @@ -3650,12 +3650,22 @@ if (info->gender != 0) oscar_string_append(gc->account, str, "\n<br>", _("Gender"), info->gender == 1 ? _("Female") : _("Male")); if ((info->birthyear > 1900) && (info->birthmonth > 0) && (info->birthday > 0)) { - struct tm tm; - tm.tm_mday = (int)info->birthday; - tm.tm_mon = (int)info->birthmonth-1; - tm.tm_year = (int)info->birthyear-1900; + /* Initialize the struct properly or strftime() will crash + * on some systems (Debian Sarge AMD64). */ + time_t t = time(NULL); + struct tm *tm = localtime(&t); + + tm->tm_mday = (int)info->birthday; + tm->tm_mon = (int)info->birthmonth - 1; + tm->tm_year = (int)info->birthyear - 1900; + + /* To be 100% sure that the fields are re-normalized. + * If you're sure strftime() ALWAYS does this EVERYWHERE, + * feel free to remove it. --rlaager */ + mktime(tm); + oscar_string_append(gc->account, str, "\n<br>", _("Birthday"), - gaim_date_format_short(&tm)); + gaim_date_format_short(tm)); } if ((info->age > 0) && (info->age < 255)) { char age[5]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |