cinera_config.c: Prevent read access crash
Passing an empty string to StripSlashes() would crash. Also add a conditional around the ctime calls in the Won Build System, to only run it if it exists.
This commit is contained in:
parent
3e0ba0b77b
commit
33e590c6da
|
@ -1,10 +1,16 @@
|
||||||
#if 0
|
#if 0
|
||||||
ctime -begin ${0%.*}.ctm
|
if [ $(command -v ctime 2>/dev/null) ]; then
|
||||||
|
ctime -begin ${0%.*}.ctm
|
||||||
|
fi
|
||||||
|
|
||||||
#gcc -g -fsanitize=address -Wall -std=c99 -pipe $0 -o ${0%.*} hmml.a -lcurl
|
#gcc -g -fsanitize=address -Wall -std=c99 -pipe $0 -o ${0%.*} hmml.a -lcurl
|
||||||
gcc -O2 -Wall -std=c99 -pipe $0 -o ${0%.*} hmml.a -lcurl
|
gcc -O2 -Wall -std=c99 -pipe $0 -o ${0%.*} hmml.a -lcurl
|
||||||
#clang -fsanitize=address -g -Wall -std=c99 -pipe $0 -o ${0%.*} hmml.a -lcurl
|
#clang -fsanitize=address -g -Wall -std=c99 -pipe $0 -o ${0%.*} hmml.a -lcurl
|
||||||
#clang -O2 -Wall -std=c99 -pipe $0 -o ${0%.*} hmml.a -lcurl
|
#clang -O2 -Wall -std=c99 -pipe $0 -o ${0%.*} hmml.a -lcurl
|
||||||
ctime -end ${0%.*}.ctm
|
|
||||||
|
if [ $(command -v ctime 2>/dev/null) ]; then
|
||||||
|
ctime -end ${0%.*}.ctm
|
||||||
|
fi
|
||||||
exit
|
exit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -17,7 +23,7 @@ typedef struct
|
||||||
version CINERA_APP_VERSION = {
|
version CINERA_APP_VERSION = {
|
||||||
.Major = 0,
|
.Major = 0,
|
||||||
.Minor = 7,
|
.Minor = 7,
|
||||||
.Patch = 5
|
.Patch = 6
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <stdarg.h> // NOTE(matt): varargs
|
#include <stdarg.h> // NOTE(matt): varargs
|
||||||
|
@ -10962,7 +10968,8 @@ typedef struct
|
||||||
void
|
void
|
||||||
OffsetAssociatedIndex(asset_index_and_location *AssetDeletionRecords, int AssetDeletionRecordCount, int32_t *Index)
|
OffsetAssociatedIndex(asset_index_and_location *AssetDeletionRecords, int AssetDeletionRecordCount, int32_t *Index)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Possibly offsetting associated index\n");
|
// TODO(matt): Do we really need to print this?
|
||||||
|
//fprintf(stderr, "Possibly offsetting associated index\n");
|
||||||
for(int i = AssetDeletionRecordCount - 1; i >= 0; --i)
|
for(int i = AssetDeletionRecordCount - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
if(*Index > AssetDeletionRecords[i].Index)
|
if(*Index > AssetDeletionRecords[i].Index)
|
||||||
|
|
|
@ -2908,19 +2908,22 @@ string
|
||||||
StripSlashes(string Path, path_relativity Relativity)
|
StripSlashes(string Path, path_relativity Relativity)
|
||||||
{
|
{
|
||||||
string Result = Path;
|
string Result = Path;
|
||||||
if(Relativity == P_REL)
|
if(Path.Length > 0)
|
||||||
{
|
{
|
||||||
while(*Result.Base == '/')
|
if(Relativity == P_REL)
|
||||||
|
{
|
||||||
|
while(*Result.Base == '/')
|
||||||
|
{
|
||||||
|
++Result.Base;
|
||||||
|
--Result.Length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while(Result.Base[Result.Length - 1] == '/')
|
||||||
{
|
{
|
||||||
++Result.Base;
|
|
||||||
--Result.Length;
|
--Result.Length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while(Result.Base[Result.Length - 1] == '/')
|
|
||||||
{
|
|
||||||
--Result.Length;
|
|
||||||
}
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue