vfs: check userland buffers before reading them.
[haiku.git] / src / servers / registrar / RosterAppInfo.cpp
blob7e012a03ec36ae41ddab60e35787ba8701ac6bba
1 /*
2 * Copyright 2001-2007, Ingo Weinhold, bonefish@users.sf.net.
3 * Distributed under the terms of the MIT License.
4 */
6 //! An extended app_info.
8 #include "RosterAppInfo.h"
10 #include <new>
11 #include <string.h>
14 using std::nothrow;
17 // constructor
18 RosterAppInfo::RosterAppInfo()
19 : app_info(),
20 state(APP_STATE_UNREGISTERED),
21 token(0),
22 registration_time(0)
27 // Init
28 void
29 RosterAppInfo::Init(thread_id thread, team_id team, port_id port, uint32 flags,
30 const entry_ref *ref, const char *signature)
32 this->thread = thread;
33 this->team = team;
34 this->port = port;
35 this->flags = flags;
36 this->ref = *ref;
37 if (signature)
38 strlcpy(this->signature, signature, B_MIME_TYPE_LENGTH);
39 else
40 this->signature[0] = '\0';
44 // Clone
45 RosterAppInfo *
46 RosterAppInfo::Clone() const
48 RosterAppInfo *clone = new(nothrow) RosterAppInfo;
49 if (!clone)
50 return NULL;
52 clone->Init(thread, team, port, flags, &ref, signature);
53 clone->registration_time = registration_time;
54 return clone;
58 // IsRunning
59 bool
60 RosterAppInfo::IsRunning() const
62 team_info teamInfo;
63 return get_team_info(team, &teamInfo) == B_OK;