MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / sysutil_check_name_string

Function sysutil_check_name_string

ps3fw/cellSysutil.cpp:404–459  ·  view source on GitHub ↗

Common string checks used in libsysutil functions

Source from the content-addressed store, hash-verified

402
403// Common string checks used in libsysutil functions
404s32 sysutil_check_name_string(const char* src, s32 minlen, s32 maxlen)
405{
406 s32 lastpos;
407
408 if (g_ps3_process_info.sdk_ver > 0x36FFFF)
409 {
410 // Limit null terminator boundary to before buffer max size
411 lastpos = std::max(maxlen - 1, 0);
412 }
413 else
414 {
415 // Limit null terminator boundary to one after buffer max size
416 lastpos = maxlen;
417 }
418
419 char cur = src[0];
420
421 if (cur == '_')
422 {
423 // Invalid character at start
424 return -1;
425 }
426
427 for (s32 index = 0;; cur = src[++index])
428 {
429 if (cur == '\0' || index == maxlen)
430 {
431 if (minlen > index || (maxlen == index && src[lastpos]))
432 {
433 // String length is invalid
434 return -2;
435 }
436
437 // OK
438 return 0;
439 }
440
441 if (cur >= 'A' && cur <= 'Z')
442 {
443 continue;
444 }
445
446 if (cur >= '0' && cur <= '9')
447 {
448 continue;
449 }
450
451 if (cur == '-' || cur == '_')
452 {
453 continue;
454 }
455
456 // Invalid character found
457 return -1;
458 }
459}
460
461error_code _cellSysutilGetSystemParamInt()

Callers 9

cellSysCacheMountFunction · 0.85
cellHddGameCheckFunction · 0.85
cellGameDataCheckCreate2Function · 0.85
check_filenameFunction · 0.85
get_save_entriesFunction · 0.85
savedata_check_argsFunction · 0.85
error_code savedata_opFunction · 0.85
LoadMethod · 0.85

Calls 1

maxFunction · 0.85

Tested by

no test coverage detected