Skip to content

Commit 7dc54ad

Browse files
committed
lib REFACTOR avoid void pointer arithmetic
1 parent c67909c commit 7dc54ad

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/io.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ nc_write(struct nc_session *session, const void *buf, uint32_t count)
580580
case NC_TI_FD:
581581
case NC_TI_UNIX:
582582
fd = session->ti_type == NC_TI_FD ? session->ti.fd.out : session->ti.unixsock.sock;
583-
c = write(fd, (char *)(buf + written), count - written);
583+
c = write(fd, (char *)buf + written, count - written);
584584
if ((c < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))) {
585585
c = 0;
586586
} else if ((c < 0) && (errno == EINTR)) {
@@ -604,14 +604,14 @@ nc_write(struct nc_session *session, const void *buf, uint32_t count)
604604
session->term_reason = NC_SESSION_TERM_DROPPED;
605605
return -1;
606606
}
607-
c = ssh_channel_write(session->ti.libssh.channel, (char *)(buf + written), count - written);
607+
c = ssh_channel_write(session->ti.libssh.channel, (char *)buf + written, count - written);
608608
if ((c == SSH_ERROR) || (c == -1)) {
609609
ERR(session, "SSH channel write failed.");
610610
return -1;
611611
}
612612
break;
613613
case NC_TI_TLS:
614-
c = nc_tls_write_wrap(session, (const unsigned char *)(buf + written), count - written);
614+
c = nc_tls_write_wrap(session, (const unsigned char *)buf + written, count - written);
615615
if (c < 0) {
616616
/* possible client dc, or some socket/TLS communication error */
617617
return -1;

src/server_config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ nc_server_config_realloc(const char *key_value, void **ptr, size_t size, void *c
557557
(*cnt)++;
558558

559559
/* access the first member of the supposed structure */
560-
name = (char **)((*ptr) + ((*cnt - 1) * size));
560+
name = (char **)((char *)(*ptr) + ((*cnt - 1) * size));
561561

562562
/* and set it's value */
563563
*name = strdup(key_value);

0 commit comments

Comments
 (0)