Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.4
finger
finger-utf8_segfault.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File finger-utf8_segfault.patch of Package finger
--- finger/sprint.c +++ finger/sprint.c @@ -49,6 +49,7 @@ PERSON *pn; WHERE *w; int cnt; + int i; char *p; PERSON **list; @@ -73,6 +74,9 @@ #define MAXREALNAME 20 #define MAXLOGINNAME 10 #define MAXHOSTNAME 20 + char *tmp = malloc( sizeof( char ) * MAXREALNAME ); + + printf ("%-*s %-*s %s %s\n", MAXLOGINNAME, "Login", MAXREALNAME, "Name", " Tty Idle Login Time ", (oflag) ? "Office Office Phone" : "Where"); @@ -81,9 +85,35 @@ pn = list[cnt]; for (w = pn->whead; w != NULL; w = w->next) { - printf ("%-*.*s %-*.*s ", MAXLOGINNAME, UT_NAMESIZE, - vs (pn->name), MAXREALNAME, MAXREALNAME, - pn->realname ? vs (pn->realname) : ""); + + if( strlen(pn->name) > MAXLOGINNAME ) + { + strncpy( tmp, pn->name, MAXLOGINNAME); + printf( "%s ", tmp ); + } + else + { + printf( "%s ", pn->name ); + for( i = strlen( pn->name ); i < MAXLOGINNAME; i ++ ) + { + printf( " " ); + } + } + + if( strlen(pn->realname) > MAXREALNAME ) + { + strncpy( tmp, pn->realname, MAXREALNAME); + printf( "%s ", tmp ); + } + else + { + printf( "%s ", pn->realname ); + for( i = strlen( pn->realname ); i < MAXREALNAME; i ++ ) + { + printf( " " ); + } + } + if (!w->loginat) { printf (" * * No logins ");
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor