Hi,

Przemysław Czerpak wrote:
If we will touch it then we should also fully remove validation
of function name at C level and pass function as string not symbol
so user can make anything with received value, i.e. he can implement
own case sensitive set of commands which are not bound with HVM
functions linked with the program. In such case I suggest to add
additional parameter <lRaw> to NETIO_RPCFUNC():
   NETIO_RPCFUNC( <pConnectionSocket> [, <sFuncSym> [, <lRaw> ] ] ) -> NIL
when <lRaw> is .T. then <sFuncSym> is executed with the following parameters:
   <sFuncSym>( <lCheck>, <cFuncName> [, <xFuncParams,...> ] )
also for NETIO_PROCEXISTS() request.
What do you think about it?

Yes, situation is a little complicated. Do we have .prg level functions to test if symbol is registered in global symbol table and is associated with function? How default rpc filter function code will look in case lRaw == .T.?

The following code (untested and perhaps is buggy) looks like security hole for me. cFunc can be used to do any macro code injection:

PROC defaultrpcfilter(lCheck, cFunc, ...)
  IF lCheck
    RETURN TYPE(cFunc + "()") == "UI"
  ENDIF
RETURN &("@" + cFunc + "()"):exec(...)


Filter hash could be used instead of filter function also: {"STR"=>@STR(), "VAL"=>@MY_VAL(), "MEMOREAD"=>@HB_MEMOREAD(), "IDLE"=>{|| NIL}}. It is less flexible solution than filter function, but can solve problem of NETIO_PROCEXIST().


Regards,
Mindaugas
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to