[Pidgin] #388: Oddity with migration (~/.gaim/logs as a symlink)
Pidgin
trac at pidgin.im
Sat Apr 28 20:28:47 EDT 2007
#388: Oddity with migration (~/.gaim/logs as a symlink)
---------------------------+------------------------------------------------
Reporter: DHowett | Owner:
Type: defect | Status: new
Priority: minor | Milestone:
Component: pidgin (gtk) | Version: 2.0
Resolution: | Keywords: migration unclosed string
---------------------------+------------------------------------------------
Comment (by DHowett):
I wrote a test program with code similar to the symlink-related code in
core.c,
{{{
int main() {
char buf[1024];
if (readlink("/home/dustin/.gaim/logs", buf, sizeof(buf) - 1) ==
-1)
{
printf("error."); return;
}
buf[sizeof(buf) - 1] = '\0';
printf("sizeof(buf) == %d\n", sizeof(buf));
printf("buf == \"%s\"\n", buf);
return;
}
}}}
The output is:
{{{
sizeof(buf) == 1024
buf == "/home/dustin/gaimlogs"
}}}
In libpurple/core.c (around line 415 in
265a50636dbd882fbee3cc061bc78e6bb73e4032), buf[sizeof(buf)-1] = '\0';
isn't truncating the string to the length of the data returned by
readlink, therefore trash characters remain at the end, possibly.
Shouldn't the return value of readlink() be used for the truncation
instead?
--
Ticket URL: <http://developer.pidgin.im/ticket/388#comment:1>
Pidgin <http://pidgin.im>
Pidgin
More information about the Tracker
mailing list