mirror of
https://github.com/RPCSX/rpcsx.git
synced 2025-12-06 07:12:14 +01:00
[orbis-kernel] Fix sys_namedobj_create
Use ureadString for name.
This commit is contained in:
parent
6f678ef595
commit
f5623fe759
|
|
@ -1,10 +1,10 @@
|
||||||
|
#include "sys/sys_sce.hpp"
|
||||||
#include "KernelContext.hpp"
|
#include "KernelContext.hpp"
|
||||||
#include "error.hpp"
|
#include "error.hpp"
|
||||||
#include "evf.hpp"
|
#include "evf.hpp"
|
||||||
#include "module/ModuleInfo.hpp"
|
#include "module/ModuleInfo.hpp"
|
||||||
#include "module/ModuleInfoEx.hpp"
|
#include "module/ModuleInfoEx.hpp"
|
||||||
#include "sys/sysproto.hpp"
|
#include "sys/sysproto.hpp"
|
||||||
#include "sys/sys_sce.hpp"
|
|
||||||
#include "utils/Logs.hpp"
|
#include "utils/Logs.hpp"
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
|
|
@ -304,14 +304,16 @@ orbis::SysResult orbis::sys_namedobj_create(Thread *thread,
|
||||||
ptr<const char> name,
|
ptr<const char> name,
|
||||||
ptr<void> object, uint16_t type) {
|
ptr<void> object, uint16_t type) {
|
||||||
ORBIS_LOG_NOTICE(__FUNCTION__, name, object, type);
|
ORBIS_LOG_NOTICE(__FUNCTION__, name, object, type);
|
||||||
utils::kstring str = name;
|
char _name[32];
|
||||||
if (str.size() > 31)
|
if (auto result = ureadString(_name, sizeof(_name), name);
|
||||||
return ErrorCode::NAMETOOLONG;
|
result != ErrorCode{}) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
if (type < 0x101 || type > 0x107)
|
if (type < 0x101 || type > 0x107)
|
||||||
return ErrorCode::INVAL;
|
return ErrorCode::INVAL;
|
||||||
|
|
||||||
std::lock_guard lock(thread->tproc->namedObjMutex);
|
std::lock_guard lock(thread->tproc->namedObjMutex);
|
||||||
if (!thread->tproc->namedObjNames.try_emplace(object, std::move(str)).second) {
|
if (!thread->tproc->namedObjNames.try_emplace(object, _name).second) {
|
||||||
ORBIS_LOG_FATAL("Named object: pointer colflict", type, object);
|
ORBIS_LOG_FATAL("Named object: pointer colflict", type, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -373,7 +375,7 @@ orbis::SysResult orbis::sys_namedobj_delete(Thread *thread, uint16_t id,
|
||||||
break;
|
break;
|
||||||
case kNamedObjTypeEqueue:
|
case kNamedObjTypeEqueue:
|
||||||
if (auto pobj = thread->tproc->equeueIds.get(id))
|
if (auto pobj = thread->tproc->equeueIds.get(id))
|
||||||
object = (void*)*pobj, thread->tproc->equeueIds.destroy(id);
|
object = (void *)*pobj, thread->tproc->equeueIds.destroy(id);
|
||||||
else
|
else
|
||||||
return ErrorCode::SRCH;
|
return ErrorCode::SRCH;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue