From 08783c93308ec84912428afc97d93d53b93fd3d3 Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Sat, 3 Nov 2018 01:11:37 +0100 Subject: #580 more robust check for remote function Use strncmp() that is bound to the function name length. --- sources/ogAdmServer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sources') diff --git a/sources/ogAdmServer.cpp b/sources/ogAdmServer.cpp index ec5430d..d4a9290 100644 --- a/sources/ogAdmServer.cpp +++ b/sources/ogAdmServer.cpp @@ -3466,7 +3466,8 @@ static bool gestionaTrama(int socket_c) nfn = copiaParametro("nfn",ptrTrama); // Toma nombre de la función for (i = 0; tbfuncionesServer[i].fptr; i++) { - res = strcmp(tbfuncionesServer[i].nf, nfn); + res = strncmp(tbfuncionesServer[i].nf, nfn, + strlen(tbfuncionesServer[i].nf)); if (res == 0) { // Encontrada la función que procesa el mensaje liberaMemoria(nfn); res=tbfuncionesServer[i].fptr(socket_c, ptrTrama); // Invoca la función -- cgit v1.2.3-18-g5258