diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-08 17:20:23 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-08 17:20:23 +0000 |
commit | d8c53b12a818ff7cf82d06a1a69c395bdef85ee6 (patch) | |
tree | 0ebb0db416c157fcfde51a941185819dd12d51fd /src/gns/w32nsp.c | |
parent | 5184c17d32a39c928c2a0fec3ee1ad098bbaa562 (diff) | |
download | gnunet-d8c53b12a818ff7cf82d06a1a69c395bdef85ee6.tar.gz gnunet-d8c53b12a818ff7cf82d06a1a69c395bdef85ee6.zip |
-avoid calling memcpy() with NULL argument, even if len is 0
Diffstat (limited to 'src/gns/w32nsp.c')
-rw-r--r-- | src/gns/w32nsp.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gns/w32nsp.c b/src/gns/w32nsp.c index a2c284fab..3e926fcc4 100644 --- a/src/gns/w32nsp.c +++ b/src/gns/w32nsp.c | |||
@@ -103,7 +103,7 @@ resize_records () | |||
103 | SetLastError (WSA_NOT_ENOUGH_MEMORY); | 103 | SetLastError (WSA_NOT_ENOUGH_MEMORY); |
104 | return 0; | 104 | return 0; |
105 | } | 105 | } |
106 | memcpy (new_records, records, records_len * sizeof (struct record)); | 106 | GNUNET_memcpy (new_records, records, records_len * sizeof (struct record)); |
107 | memset (&new_records[records_len], 0, sizeof (struct record) * (new_size - records_len)); | 107 | memset (&new_records[records_len], 0, sizeof (struct record) * (new_size - records_len)); |
108 | records_size = new_size; | 108 | records_size = new_size; |
109 | free (records); | 109 | free (records); |
@@ -229,7 +229,7 @@ send_name_to_ip_request (LPWSAQUERYSETW lpqsRestrictions, | |||
229 | else | 229 | else |
230 | msg->af = htonl (AF_UNSPEC); | 230 | msg->af = htonl (AF_UNSPEC); |
231 | if (lpqsRestrictions->lpszServiceInstanceName) | 231 | if (lpqsRestrictions->lpszServiceInstanceName) |
232 | memcpy (&msg[1], lpqsRestrictions->lpszServiceInstanceName, namelen); | 232 | GNUNET_memcpy (&msg[1], lpqsRestrictions->lpszServiceInstanceName, namelen); |
233 | msg->sc_data1 = htonl (lpqsRestrictions->lpServiceClassId->Data1); | 233 | msg->sc_data1 = htonl (lpqsRestrictions->lpServiceClassId->Data1); |
234 | msg->sc_data2 = htons (lpqsRestrictions->lpServiceClassId->Data2); | 234 | msg->sc_data2 = htons (lpqsRestrictions->lpServiceClassId->Data2); |
235 | msg->sc_data3 = htons (lpqsRestrictions->lpServiceClassId->Data3); | 235 | msg->sc_data3 = htons (lpqsRestrictions->lpServiceClassId->Data3); |
@@ -425,7 +425,7 @@ GNUNET_W32NSP_LookupServiceNext (HANDLE hLookup, DWORD dwControlFlags, | |||
425 | //LeaveCriticalSection (&records_cs); | 425 | //LeaveCriticalSection (&records_cs); |
426 | return SOCKET_ERROR; | 426 | return SOCKET_ERROR; |
427 | } | 427 | } |
428 | memcpy (lpqsResults, &((struct GNUNET_W32RESOLVER_GetMessage *)records[rec].buf)[1], header.size - sizeof (struct GNUNET_W32RESOLVER_GetMessage)); | 428 | GNUNET_memcpy (lpqsResults, &((struct GNUNET_W32RESOLVER_GetMessage *)records[rec].buf)[1], header.size - sizeof (struct GNUNET_W32RESOLVER_GetMessage)); |
429 | free (records[rec].buf); | 429 | free (records[rec].buf); |
430 | records[rec].buf = NULL; | 430 | records[rec].buf = NULL; |
431 | //LeaveCriticalSection (&records_cs); | 431 | //LeaveCriticalSection (&records_cs); |
@@ -508,7 +508,7 @@ GNUNET_W32NSP_LookupServiceNext (HANDLE hLookup, DWORD dwControlFlags, | |||
508 | } | 508 | } |
509 | records[rec].state |= 8; | 509 | records[rec].state |= 8; |
510 | //LeaveCriticalSection (&records_cs); | 510 | //LeaveCriticalSection (&records_cs); |
511 | memcpy (buf, &header, sizeof (header)); | 511 | GNUNET_memcpy (buf, &header, sizeof (header)); |
512 | to_receive = header.size - sizeof (header); | 512 | to_receive = header.size - sizeof (header); |
513 | rc = 0; | 513 | rc = 0; |
514 | #if VERBOSE | 514 | #if VERBOSE |
@@ -567,7 +567,7 @@ GNUNET_W32NSP_LookupServiceNext (HANDLE hLookup, DWORD dwControlFlags, | |||
567 | } | 567 | } |
568 | //LeaveCriticalSection (&records_cs); | 568 | //LeaveCriticalSection (&records_cs); |
569 | DEBUGLOG ("GNUNET_W32NSP_LookupServiceNext: writing %d bytes into result buffer\n", header.size - sizeof (struct GNUNET_W32RESOLVER_GetMessage)); | 569 | DEBUGLOG ("GNUNET_W32NSP_LookupServiceNext: writing %d bytes into result buffer\n", header.size - sizeof (struct GNUNET_W32RESOLVER_GetMessage)); |
570 | memcpy (lpqsResults, &((struct GNUNET_W32RESOLVER_GetMessage *)buf)[1], header.size - sizeof (struct GNUNET_W32RESOLVER_GetMessage)); | 570 | GNUNET_memcpy (lpqsResults, &((struct GNUNET_W32RESOLVER_GetMessage *)buf)[1], header.size - sizeof (struct GNUNET_W32RESOLVER_GetMessage)); |
571 | free (buf); | 571 | free (buf); |
572 | DEBUGLOG ("GNUNET_W32NSP_LookupServiceNext: OK\n"); | 572 | DEBUGLOG ("GNUNET_W32NSP_LookupServiceNext: OK\n"); |
573 | UnmarshallWSAQUERYSETW ((LPWSAQUERYSETW) lpqsResults); | 573 | UnmarshallWSAQUERYSETW ((LPWSAQUERYSETW) lpqsResults); |