[PATCH] winbindd_wins' illegal usage of strncat (was: latest 2.2 cvs does not compile)
Alexander Bokovoy
a.bokovoy at sam-solutions.net
Tue Jan 15 10:59:03 GMT 2002
On Tue, Jan 15, 2002 at 03:29:09PM +0100, andreas moroder wrote:
> Hello,
>
> in the latest 2.2 cvs i get a error while compiling winbindd_wins.c .
> strncat is used, but a macro defines it as illegal.
Patch attached. It is valid for both SAMBA_2_2 and HEAD.
--
/ Alexander Bokovoy
$ cat /proc/identity >~/.signature
`Senior software developer and analyst for SaM-Solutions Ltd.`
---
Nov 21 20:58:58 alconost kernel: VFS: Busy inodes after unmount.
Self-destruct in 5 seconds. Have a nice day...
-------------- next part --------------
diff -urk.orig ./source/nsswitch/winbindd_wins.c.orig ./source/nsswitch/winbindd_wins.c
--- ./source/nsswitch/winbindd_wins.c.orig Tue Jan 15 03:46:24 2002
+++ ./source/nsswitch/winbindd_wins.c Tue Jan 15 19:39:40 2002
@@ -135,15 +135,15 @@
*response = '\0';
len = sizeof(response) - 2;
- if ( status = lookup_byaddr_backend(state->request.data.name, &count)) {
+ if ( (status = lookup_byaddr_backend(state->request.data.name, &count))) {
size = strlen(state->request.data.name) + 1;
if (size > len) {
SAFE_FREE(status);
return WINBINDD_ERROR;
}
len -= size;
- strncat(response,state->request.data.name,size);
- strncat(response,"\t",1);
+ safe_strcat(response,state->request.data.name,size - 1);
+ safe_strcat(response,"\t",1);
for (i = 0; i < count; i++) {
/* ignore group names */
if (status[i].flags & 0x80) continue;
@@ -154,8 +154,8 @@
return WINBINDD_ERROR;
}
len -= size;
- strncat(response, status[i].name, size);
- strncat(response, " ", 1);
+ safe_strcat(response, status[i].name, size - 1);
+ safe_strcat(response, " ", 1);
}
}
response[strlen(response)-1] = '\n';
@@ -180,7 +180,7 @@
*response = '\0';
len = sizeof(response) - 2;
- if (ip_list = lookup_byname_backend(state->request.data.name, &count)) {
+ if ((ip_list = lookup_byname_backend(state->request.data.name, &count))) {
for (i = count; i ; i--) {
addr = inet_ntoa(ip_list[i-1]);
size = strlen(addr) + 1;
@@ -191,16 +191,16 @@
len -= size;
if (i != 0)
response[strlen(response)-1] = ' ';
- strncat(response,addr,size);
- strncat(response,"\t",1);
+ safe_strcat(response,addr,size - 1);
+ safe_strcat(response,"\t",1);
}
size = strlen(state->request.data.name) + 1;
if (size > len) {
SAFE_FREE(ip_list);
return WINBINDD_ERROR;
}
- strncat(response,state->request.data.name,size);
- strncat(response,"\n",1);
+ safe_strcat(response,state->request.data.name,size - 1);
+ safe_strcat(response,"\n",1);
SAFE_FREE(ip_list);
} else
return WINBINDD_ERROR;
More information about the samba-technical
mailing list