Skip to content

Commit 3dfdcd5

Browse files
committed
Temporarily use another amx_getPublic since the original one tries to dereference an invalid address, ideally it would be better to just use pawn-lang's amx's library
1 parent dd15602 commit 3dfdcd5

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

amx-deps/src/amx/amx.c

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,24 +1709,21 @@ int AMXAPI amx_NumPublics(AMX *amx, int *number)
17091709
return AMX_ERR_NONE;
17101710
}
17111711

1712-
int AMXAPI amx_GetPublic(AMX *amx, int index, char *funcname, ucell *address)
1712+
int AMXAPI amx_GetPublic(AMX* amx, int index, char* funcname)
17131713
{
1714-
AMX_HEADER *hdr;
1715-
AMX_FUNCSTUB *func;
1716-
1717-
hdr=(AMX_HEADER *)amx->base;
1718-
assert(hdr!=NULL);
1719-
assert(hdr->magic==AMX_MAGIC);
1720-
assert(hdr->publics<=hdr->natives);
1721-
if (index>=(cell)NUMENTRIES(hdr,publics,natives))
1722-
return AMX_ERR_INDEX;
1723-
1724-
func=GETENTRY(hdr,publics,index);
1725-
if (funcname!=NULL)
1726-
strcpy(funcname,GETENTRYNAME(hdr,func));
1727-
if (address!=NULL)
1728-
*address=func->address;
1729-
return AMX_ERR_NONE;
1714+
AMX_HEADER* hdr;
1715+
AMX_FUNCSTUB* func;
1716+
1717+
hdr = (AMX_HEADER*)amx->base;
1718+
assert(hdr != NULL);
1719+
assert(hdr->magic == AMX_MAGIC);
1720+
assert(hdr->publics <= hdr->natives);
1721+
if (index >= (cell)NUMENTRIES(hdr, publics, natives))
1722+
return AMX_ERR_INDEX;
1723+
1724+
func = GETENTRY(hdr, publics, index);
1725+
strcpy(funcname, GETENTRYNAME(hdr, func));
1726+
return AMX_ERR_NONE;
17301727
}
17311728

17321729
int AMXAPI amx_FindPublic(AMX *amx, const char *name, int *index)
@@ -1740,7 +1737,7 @@ int AMXAPI amx_FindPublic(AMX *amx, const char *name, int *index)
17401737
/* binary search */
17411738
while (first<=last) {
17421739
mid=(first+last)/2;
1743-
amx_GetPublic(amx,mid,pname,NULL);
1740+
amx_GetPublic(amx,mid,pname);
17441741
result=strcmp(pname,name);
17451742
if (result>0) {
17461743
last=mid-1;

amx-deps/src/amx/amx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ int AMXAPI amx_FindTagId(AMX *amx, cell tag_id, char *tagname);
430430
int AMXAPI amx_Flags(AMX *amx,uint16_t *flags);
431431
int AMXAPI amx_GetAddr(AMX *amx,cell amx_addr,cell **phys_addr);
432432
int AMXAPI amx_GetNative(AMX *amx, int index, char *funcname);
433-
int AMXAPI amx_GetPublic(AMX *amx, int index, char *funcname, ucell *address);
433+
int AMXAPI amx_GetPublic(AMX *amx, int index, char *funcname);
434434
int AMXAPI amx_GetPubVar(AMX *amx, int index, char *varname, cell *amx_addr);
435435
int AMXAPI amx_GetString(char *dest,const cell *source, int use_wchar, size_t size);
436436
int AMXAPI amx_GetTag(AMX *amx, int index, char *tagname, cell *tag_id);

0 commit comments

Comments
 (0)