Skip to content

Commit b08136e

Browse files
committed
Fix:heap overflow in ntlmv2_hash()
1 parent 5ef971d commit b08136e

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

nasl/nasl_snmp.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -419,19 +419,19 @@ check_spwan_output (int fd, snmp_result_t result, int fd_flag)
419419
while (1)
420420
{
421421
char buf[4096];
422-
size_t bytes;
422+
ssize_t bytes;
423423

424424
bytes = read (fd, buf, sizeof (buf));
425-
if (!bytes)
426-
break;
427-
else if (bytes > 0)
428-
g_string_append_len (string, buf, bytes);
429-
else
425+
if (bytes < 0)
430426
{
431427
g_warning ("snmpget: %s", strerror (errno));
432428
g_string_free (string, TRUE);
433429
return -1;
434430
}
431+
if (!bytes)
432+
break;
433+
else if (bytes > 0)
434+
g_string_append_len (string, buf, bytes);
435435
}
436436

437437
// Split the result and store the oid and name

nasl/smb_signing.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
*/
1919

2020
#include "smb_signing.h"
21+
2122
#include <stdint.h>
2223

2324
int
24-
simple_packet_signature_ntlmssp (uint8_t *mac_key, const uchar *buf, size_t buf_len,
25-
uint32 seq_number, unsigned char *calc_md5_mac)
25+
simple_packet_signature_ntlmssp (uint8_t *mac_key, const uchar *buf,
26+
size_t buf_len, uint32 seq_number,
27+
unsigned char *calc_md5_mac)
2628
{
2729
const size_t offset_end_of_sig = (smb_ss_field + 8);
2830
unsigned char sequence_buf[8];

0 commit comments

Comments
 (0)