Skip to content

Commit

Permalink
Set tun devname to IFNAMESIZ+1 to avoid warning
Browse files Browse the repository at this point in the history
Relevant output from make:

../lib/tun.c: In function ‘tun_new’:
../lib/tun.c:688: warning: array subscript is above array bounds

Caused by assignement:
(*tun)->devname[IFNAMSIZ] = 0;
while devname defined as:
char devname[IFNAMSIZ];

Signed-off-by: Emmanuel Bretelle <[email protected]>
  • Loading branch information
chantra authored and laf0rge committed Oct 20, 2010
1 parent 2a10368 commit eaaf500
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tun.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct tun_t {
struct in_addr netmask;
int addrs; /* Number of allocated IP addresses */
int routes; /* One if we allocated an automatic route */
char devname[IFNAMSIZ];/* Name of the tun device */
char devname[IFNAMSIZ+1];/* Name of the tun device */
int (*cb_ind) (struct tun_t *tun, void *pack, unsigned len);
};

Expand Down

0 comments on commit eaaf500

Please sign in to comment.