summaryrefslogtreecommitdiffstats
path: root/source3/printing/pcap.c
diff options
context:
space:
mode:
authorJames Peach <jpeach@samba.org>2007-11-21 18:31:35 -0800
committerJames Peach <jpeach@samba.org>2007-11-21 18:31:35 -0800
commit64b54e534008a1ac36b9ba21726ca0954fe00d63 (patch)
tree5a5e0f42c70d4afa14ba689bf4f97af321432510 /source3/printing/pcap.c
parentfebaaae2021c2993d265cc48cf9fbef05cb4ed1b (diff)
parent7ef6c19074495110d5c0b698b05c4ee52a0744d6 (diff)
downloadsamba-64b54e534008a1ac36b9ba21726ca0954fe00d63.tar.gz
samba-64b54e534008a1ac36b9ba21726ca0954fe00d63.tar.xz
samba-64b54e534008a1ac36b9ba21726ca0954fe00d63.zip
Merge ssh://git.samba.org/data/git/samba into v3-2-test
(This used to be commit 660ea443364e949ed06c28b00f0e1c3757f0da27)
Diffstat (limited to 'source3/printing/pcap.c')
-rw-r--r--source3/printing/pcap.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/source3/printing/pcap.c b/source3/printing/pcap.c
index aabdb73e2e..30cb254a29 100644
--- a/source3/printing/pcap.c
+++ b/source3/printing/pcap.c
@@ -159,8 +159,9 @@ void pcap_cache_reload(void)
goto done;
}
- for (; (pcap_line = fgets_slash(NULL, sizeof(pstring), pcap_file)) != NULL; safe_free(pcap_line)) {
- pstring name, comment;
+ for (; (pcap_line = fgets_slash(NULL, 1024, pcap_file)) != NULL; safe_free(pcap_line)) {
+ char name[MAXPRINTERLEN+1];
+ char comment[62];
char *p, *q;
if (*pcap_line == '#' || *pcap_line == 0)
@@ -186,22 +187,22 @@ void pcap_cache_reload(void)
strchr_m(p, ')'));
if (strlen(p) > strlen(comment) && has_punctuation) {
- pstrcpy(comment, p);
+ strlcpy(comment, p, sizeof(comment));
continue;
}
if (strlen(p) <= MAXPRINTERLEN &&
strlen(p) > strlen(name) && !has_punctuation) {
- if (!*comment)
- pstrcpy(comment, name);
-
- pstrcpy(name, p);
+ if (!*comment) {
+ strlcpy(comment, name, sizeof(comment));
+ }
+ strlcpy(name, p, sizeof(name));
continue;
}
if (!strchr_m(comment, ' ') &&
strlen(p) > strlen(comment)) {
- pstrcpy(comment, p);
+ strlcpy(comment, p, sizeof(comment));
continue;
}
}