summaryrefslogtreecommitdiffstats
path: root/admin/Sources
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2020-04-08 14:25:41 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-04-08 14:29:37 +0200
commitdb2e57f75acb73952f1227d071e81713423ef811 (patch)
tree136aad0de294c50eea37487cdab2f9ce81573c7a /admin/Sources
parentd9b24135c7af8e0b099ceb71b3b355e963344cf8 (diff)
#580 invalid access to memory in contieneIP()
valgrind reports incorrect access to memory: ==16622== 4000 errors in context 1 of 2: ==16622== Conditional jump or move depends on uninitialised value(s) ==16622== at 0x10C380: contieneIP (ogAdmLib.c:514) ==16622== by 0x10D842: clienteExistente (ogAdmServer.c:206) ==16622== by 0x10D743: clienteDisponible (ogAdmServer.c:173) ==16622== by 0x10FE62: og_send_cmd (ogAdmServer.c:1106) ==16622== by 0x114651: og_cmd_legacy_send (ogAdmServer.c:3159) ==16622== by 0x114795: og_cmd_post_clients (ogAdmServer.c:3188) ==16622== by 0x1193F5: og_client_state_process_payload_rest (ogAdmServer.c:4444) ==16622== by 0x11A354: og_client_read_cb (ogAdmServer.c:4728) ==16622== by 0x693ED72: ev_invoke_pending (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0) ==16622== by 0x69423DD: ev_run (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0) ==16622== by 0x10D19C: ev_loop (ev.h:835) ==16622== by 0x11AAED: main (ogAdmServer.c:4896) ==16622== Uninitialised value was created by a heap allocation ==16622== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==16622== by 0x6B4D80A: ??? (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.11.0) ==16622== by 0x6B4DDCB: ??? (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.11.0) ==16622== by 0x6B4DCA6: ??? (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.11.0) ==16622== by 0x6B4DF55: ??? (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.11.0) ==16622== by 0x6B4E0CB: json_loads (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.11.0) ==16622== by 0x1192F2: og_client_state_process_payload_rest (ogAdmServer.c:4425) ==16622== by 0x11A354: og_client_read_cb (ogAdmServer.c:4728) ==16622== by 0x693ED72: ev_invoke_pending (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0) ==16622== by 0x69423DD: ev_run (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0) ==16622== by 0x10D19C: ev_loop (ev.h:835) ==16622== by 0x11AAED: main (ogAdmServer.c:4896)
Diffstat (limited to 'admin/Sources')
-rw-r--r--admin/Sources/Includes/ogAdmLib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/admin/Sources/Includes/ogAdmLib.c b/admin/Sources/Includes/ogAdmLib.c
index 7faa9f08..2f0a714d 100644
--- a/admin/Sources/Includes/ogAdmLib.c
+++ b/admin/Sources/Includes/ogAdmLib.c
@@ -503,16 +503,16 @@ char* copiaParametro(const char*nombre,TRAMA* ptrTrama)
BOOLEAN contieneIP(char *cadenaiph,char *ipcliente)
{
char *posa,*posb;
- int lon;
+ int lon, i;
posa=strstr(cadenaiph,ipcliente);
if(posa==NULL) return(FALSE); // No existe la IP en la cadena
posb=posa; // Iguala direcciones
- while(TRUE){
- posb++;
+ for (i = 0; i < LONIP; i++) {
if(*posb==';') break;
if(*posb=='\0') break;
if(*posb=='\r') break;
+ posb++;
}
lon=strlen(ipcliente);
if((posb-posa)==lon) return(TRUE); // IP encontrada