1
0
mirror of https://github.com/pcvolkmer/osc-variant.git synced 2025-04-19 19:56:50 +00:00

fix: memory cleanup

This commit is contained in:
Paul-Christian Volkmer 2024-10-31 23:00:40 +01:00
parent 3274b728c3
commit e053c212df
4 changed files with 10 additions and 12 deletions

2
Cargo.lock generated
View File

@ -273,7 +273,7 @@ checksum = "da692b8d1080ea3045efaab14434d40468c3d8657e42abddfffca87b428f4c1b"
[[package]]
name = "deob"
version = "0.1.0"
version = "0.1.1"
dependencies = [
"cc",
]

View File

@ -1,6 +1,6 @@
[package]
name = "deob"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
[build-dependencies]

View File

@ -21,16 +21,13 @@
#include "deob.h"
void deob(char *in) {
char *d = malloc(LD*sizeof(char));
const long long s[2] = {S0, S1};
char d[] = "OSTAR.password$OSB";
for (size_t i = 0; i < DL; i++) d[i] = (CS)[i];
for (size_t i = 0; i < LD; i++) d[i] = (CS)[i];
size_t l = strlen(in) / 2;
for (size_t i = 0; i < l; i++) {
for (size_t j = 0; j < DL; j++) {
DLT(0);
DLT(1);
}
for (size_t j = 0; j < LD; j++) { DLT(0); DLT(1); }
DLS(i);
}
INZ(l);
INZ(l); F(d);
}

View File

@ -28,11 +28,12 @@
#define S0 8373972096940928081
#define S1 7378413942531504450
#define CS (char*)&s
#define DL sizeof(d) / sizeof(d[0]) - 3
#define I2 i*2
#define INZ(var) in[var] = 0
#define DLS(idx) in[idx] = (d[DL+1]<<4)|d[DL]
#define DLT(idx) d[DL+idx] = (in[I2+idx] == d[j]) ? (char)j : d[DL+idx]
#define LD 16
#define DLS(idx) in[idx] = (d[LD+1]<<4)|d[LD]
#define DLT(idx) d[LD+idx] = (in[I2+idx] == d[j]) ? (char)j : d[LD+idx]
#define F(var) free(var)
void deob(char *in);