Skip to content

Commit 73066c1

Browse files
committed
crazy
1 parent 2d7d688 commit 73066c1

File tree

1 file changed

+35
-30
lines changed

1 file changed

+35
-30
lines changed

libr/esil/esil_ops.c

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,18 +1596,19 @@ static bool esil_peek_some(REsil *esil) {
15961596
static bool esil_mem_oreq_n(REsil *esil, int bits) {
15971597
bool ret = false;
15981598
ut64 s, d;
1599-
const char *dst = r_esil_pop (esil); // save the dst-addr
1600-
const char *src0 = r_esil_pop (esil); // get the src
1601-
const char *src1 = NULL;
1602-
if (src0 && r_esil_get_parm (esil, src0, &s)) { // get the src
1603-
r_esil_push (esil, dst); // push the dst-addr
1604-
ret = !!esil_peek_n (esil, bits); // read
1605-
src1 = r_esil_pop (esil); // get the old dst-value
1606-
if (src1 && r_esil_get_parm (esil, src1, &d)) { // get the old dst-value
1607-
d |= s; // calculate the new dst-value
1608-
r_esil_pushnum (esil, d); // push the new dst-value
1609-
r_esil_push (esil, dst); // push the dst-addr
1610-
ret &= (!!esil_poke_n (esil, bits)); // write
1599+
const char *dst = r_esil_pop (esil);
1600+
char dst_buf[R_ESIL_TOKEN_SIZE];
1601+
const char *src0 = r_esil_pop (esil);
1602+
if (dst && src0 && r_esil_get_parm (esil, src0, &s)) {
1603+
r_str_ncpy (dst_buf, dst, sizeof (dst_buf));
1604+
r_esil_push (esil, dst_buf);
1605+
ret = !!esil_peek_n (esil, bits);
1606+
const char *src1 = r_esil_pop (esil);
1607+
if (src1 && r_esil_get_parm (esil, src1, &d)) {
1608+
d |= s;
1609+
r_esil_pushnum (esil, d);
1610+
r_esil_push (esil, dst_buf);
1611+
ret &= (!!esil_poke_n (esil, bits));
16111612
} else {
16121613
ret = false;
16131614
}
@@ -1637,16 +1638,17 @@ static bool esil_mem_xoreq_n(REsil *esil, int bits) {
16371638
bool ret = false;
16381639
ut64 s, d;
16391640
const char *dst = r_esil_pop (esil);
1641+
char dst_buf[R_ESIL_TOKEN_SIZE];
16401642
const char *src0 = r_esil_pop (esil);
1641-
const char *src1 = NULL;
1642-
if (src0 && r_esil_get_parm (esil, src0, &s)) {
1643-
r_esil_push (esil, dst);
1643+
if (dst && src0 && r_esil_get_parm (esil, src0, &s)) {
1644+
r_str_ncpy (dst_buf, dst, sizeof (dst_buf));
1645+
r_esil_push (esil, dst_buf);
16441646
ret = !!esil_peek_n (esil, bits);
1645-
src1 = r_esil_pop (esil);
1647+
const char *src1 = r_esil_pop (esil);
16461648
if (src1 && r_esil_get_parm (esil, src1, &d)) {
16471649
d ^= s;
16481650
r_esil_pushnum (esil, d);
1649-
r_esil_push (esil, dst);
1651+
r_esil_push (esil, dst_buf);
16501652
ret &= (!!esil_poke_n (esil, bits));
16511653
} else {
16521654
ret = false;
@@ -1677,16 +1679,17 @@ static bool esil_mem_andeq_n(REsil *esil, int bits) {
16771679
bool ret = false;
16781680
ut64 s, d;
16791681
const char *dst = r_esil_pop (esil);
1682+
char dst_buf[R_ESIL_TOKEN_SIZE];
16801683
const char *src0 = r_esil_pop (esil);
1681-
const char *src1 = NULL;
1682-
if (src0 && r_esil_get_parm (esil, src0, &s)) {
1683-
r_esil_push (esil, dst);
1684+
if (dst && src0 && r_esil_get_parm (esil, src0, &s)) {
1685+
r_str_ncpy (dst_buf, dst, sizeof (dst_buf));
1686+
r_esil_push (esil, dst_buf);
16841687
ret = (!!esil_peek_n (esil, bits));
1685-
src1 = r_esil_pop (esil);
1688+
const char *src1 = r_esil_pop (esil);
16861689
if (src1 && r_esil_get_parm (esil, src1, &d)) {
16871690
d &= s;
16881691
r_esil_pushnum (esil, d);
1689-
r_esil_push (esil, dst);
1692+
r_esil_push (esil, dst_buf);
16901693
ret &= (!!esil_poke_n (esil, bits));
16911694
} else {
16921695
ret = false;
@@ -1933,18 +1936,19 @@ static bool esil_mem_inceq_n(REsil *esil, int bits) {
19331936
bool ret = false;
19341937
ut64 s;
19351938
const char *off = r_esil_pop (esil);
1936-
const char *src = NULL;
1939+
char off_buf[R_ESIL_TOKEN_SIZE];
19371940
if (off) {
1938-
r_esil_push (esil, off);
1941+
r_str_ncpy (off_buf, off, sizeof (off_buf));
1942+
r_esil_push (esil, off_buf);
19391943
ret = !!esil_peek_n (esil, bits);
1940-
src = r_esil_pop (esil);
1944+
const char *src = r_esil_pop (esil);
19411945
if (src && r_esil_get_parm (esil, src, &s)) {
19421946
esil->old = s;
19431947
s++;
19441948
esil->cur = s;
19451949
esil->lastsz = bits;
19461950
r_esil_pushnum (esil, s);
1947-
r_esil_push (esil, off);
1951+
r_esil_push (esil, off_buf);
19481952
ret &= (!!esil_poke_n (esil, bits));
19491953
} else {
19501954
ret = false;
@@ -1975,15 +1979,16 @@ static bool esil_mem_deceq_n(REsil *esil, int bits) {
19751979
bool ret = false;
19761980
ut64 s;
19771981
const char *off = r_esil_pop (esil);
1978-
const char *src = NULL;
1982+
char off_buf[R_ESIL_TOKEN_SIZE];
19791983
if (off) {
1980-
r_esil_push (esil, off);
1984+
r_str_ncpy (off_buf, off, sizeof (off_buf));
1985+
r_esil_push (esil, off_buf);
19811986
ret = !!esil_peek_n (esil, bits);
1982-
src = r_esil_pop (esil);
1987+
const char *src = r_esil_pop (esil);
19831988
if (src && r_esil_get_parm (esil, src, &s)) {
19841989
s--;
19851990
r_esil_pushnum (esil, s);
1986-
r_esil_push (esil, off);
1991+
r_esil_push (esil, off_buf);
19871992
ret &= (!!esil_poke_n (esil, bits));
19881993
} else {
19891994
ret = false;

0 commit comments

Comments
 (0)