aboutsummaryrefslogtreecommitdiff
path: root/hardinfo
diff options
context:
space:
mode:
Diffstat (limited to 'hardinfo')
-rw-r--r--hardinfo/socket.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hardinfo/socket.c b/hardinfo/socket.c
index 339df30e..40cb8e50 100644
--- a/hardinfo/socket.c
+++ b/hardinfo/socket.c
@@ -96,10 +96,10 @@ int sock_ready_to_write(Socket * s)
int sock_read(Socket * s, gchar * buffer, gint size)
{
- if (sock_ready_to_read(s)) {
+ if (size > 2 && sock_ready_to_read(s)) {
gint n;
- n = read(s->sock, buffer, size);
+ n = read(s->sock, buffer, size - 1);
if (n > 0) {
buffer[n] = '\0';
} else {