From b6f36d43805a225df95c8499b9cce19ca57d36fd Mon Sep 17 00:00:00 2001 From: "tim.schubert@tu-bs.de" Date: Fri, 28 Oct 2016 19:09:10 +0200 Subject: [PATCH] Fixed %u and %s mixup. --- netcalc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/netcalc.c b/netcalc.c index 44d3364..225b4ea 100644 --- a/netcalc.c +++ b/netcalc.c @@ -218,7 +218,7 @@ int server() free(bin); } - if (send(c_fd, buf, sizeof buf, 0) == -1) { + if (send(c_fd, buf, strlen(buf)+1, 0) == -1) { perror("send"); continue; } @@ -253,7 +253,8 @@ int client() if (status == -1) { report_error(buf, BUFLEN, "parse: failed to parse"); } else if (status == -2) { - sprintf(buf, "%u%c%u", num1, '+', "0"); + printf("ZORK\n"); + sprintf(buf, "%u%c%s", num1, '+', "0"); } else { sprintf(buf, "%u%c%u", num1, op, num2); }