Manually prevent placeholder/content appending
This commit is contained in:
@@ -157,6 +157,14 @@ namespace sts::ncm {
|
||||
|
||||
auto file_guard = SCOPE_GUARD { fclose(f); };
|
||||
|
||||
u64 size = 0;
|
||||
R_TRY(GetSizeFromPlaceHolderId(&size, placeholder_id));
|
||||
|
||||
/* We can't disable append with stdio, so check this manually. */
|
||||
if (offset + data.num_elements > size) {
|
||||
return ResultFileExtensionWithoutOpenModeAllowAppend;
|
||||
}
|
||||
|
||||
if (fseek(f, offset, SEEK_SET) != 0) {
|
||||
return fsdevGetLastResult();
|
||||
}
|
||||
@@ -585,6 +593,14 @@ namespace sts::ncm {
|
||||
fclose(f);
|
||||
};
|
||||
|
||||
u64 size = 0;
|
||||
R_TRY(GetSizeFromContentId(&size, content_id));
|
||||
|
||||
/* We can't disable append with stdio, so check this manually. */
|
||||
if (offset + data.num_elements > size) {
|
||||
return ResultFileExtensionWithoutOpenModeAllowAppend;
|
||||
}
|
||||
|
||||
if (fseek(f, offset, SEEK_SET) != 0) {
|
||||
return fsdevGetLastResult();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user