From e0d87ae0d9b5b55830ea1d30b65669bd1105485c Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sat, 12 Jan 2008 23:19:58 +0100 Subject: [PATCH] use a_strncpy --- widget.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/widget.c b/widget.c index 0ff23138..4baa79ba 100644 --- a/widget.c +++ b/widget.c @@ -146,7 +146,7 @@ uicb_widget_tell(int screen, char *arg) { Widget *widget; char *p, *command; - int len; + ssize_t len; if (!arg) { @@ -169,11 +169,12 @@ uicb_widget_tell(int screen, char *arg) return; } - if(p + a_strlen(p) < arg+len) + if(p + a_strlen(p) < arg + len) { p = p + a_strlen(p) + 1; - command = p_new(char, a_strlen(p) + 1); - strncpy(command, p, a_strlen(p)); + len = a_strlen(p); + command = p_new(char, len + 1); + a_strncpy(command, len + 1, p, len); widget->tell(widget, command); p_delete(&command); }