mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix more sprintf calls.
This commit is contained in:
parent
24c0f2010c
commit
1d935059fb
5 changed files with 22 additions and 20 deletions
|
@ -144,12 +144,12 @@ _DtCm_appt4_to_attrs(
|
||||||
ptr2 = (ptr1 ? strchr(ptr1, '.') : NULL);
|
ptr2 = (ptr1 ? strchr(ptr1, '.') : NULL);
|
||||||
|
|
||||||
if (ptr1) {
|
if (ptr1) {
|
||||||
sprintf(buf, "%d:%s%s%s", a4->appt_id.key, calname,
|
snprintf(buf, sizeof buf, "%d:%s%s%s", a4->appt_id.key, calname,
|
||||||
(ptr2 == NULL ? "." : ""),
|
(ptr2 == NULL ? "." : ""),
|
||||||
(ptr2 == NULL ? _DtCmGetLocalDomain(ptr1+1) :
|
(ptr2 == NULL ? _DtCmGetLocalDomain(ptr1+1) :
|
||||||
""));
|
""));
|
||||||
} else {
|
} else {
|
||||||
sprintf(buf, "%d:%s@%s", a4->appt_id.key, calname,
|
snprintf(buf, sizeof buf, "%d:%s@%s", a4->appt_id.key, calname,
|
||||||
_DtCmGetHostAtDomain());
|
_DtCmGetHostAtDomain());
|
||||||
}
|
}
|
||||||
opq.size = strlen(buf);
|
opq.size = strlen(buf);
|
||||||
|
@ -450,43 +450,44 @@ _RepeatInfoToRule(Appt_4 *a4, cms_attribute_value **attrval)
|
||||||
|
|
||||||
switch (a4->period.period) {
|
switch (a4->period.period) {
|
||||||
case daily_4:
|
case daily_4:
|
||||||
sprintf(buf, "D1 #%d ", duration);
|
snprintf(buf, sizeof buf, "D1 #%d ", duration);
|
||||||
break;
|
break;
|
||||||
case weekly_4:
|
case weekly_4:
|
||||||
sprintf(buf, "W1 #%d ", duration);
|
snprintf(buf, sizeof buf, "W1 #%d ", duration);
|
||||||
break;
|
break;
|
||||||
case biweekly_4:
|
case biweekly_4:
|
||||||
sprintf(buf, "W2 #%d ", duration);
|
snprintf(buf, sizeof buf, "W2 #%d ", duration);
|
||||||
break;
|
break;
|
||||||
case monthly_4:
|
case monthly_4:
|
||||||
sprintf(buf, "MD1 #%d ", duration);
|
snprintf(buf, sizeof buf, "MD1 #%d ", duration);
|
||||||
break;
|
break;
|
||||||
case yearly_4:
|
case yearly_4:
|
||||||
sprintf(buf, "YM1 #%d ", duration);
|
snprintf(buf, sizeof buf, "YM1 #%d ", duration);
|
||||||
break;
|
break;
|
||||||
case nthWeekday_4:
|
case nthWeekday_4:
|
||||||
sprintf(buf, "MP1 #%d ", duration);
|
snprintf(buf, sizeof buf, "MP1 #%d ", duration);
|
||||||
break;
|
break;
|
||||||
case everyNthDay_4:
|
case everyNthDay_4:
|
||||||
sprintf(buf, "D%d #%d ", a4->period.nth, duration);
|
snprintf(buf, sizeof buf, "D%d #%d ", a4->period.nth, duration);
|
||||||
break;
|
break;
|
||||||
case everyNthWeek_4:
|
case everyNthWeek_4:
|
||||||
sprintf(buf, "W%d #%d ", a4->period.nth, duration);
|
snprintf(buf, sizeof buf, "W%d #%d ", a4->period.nth, duration);
|
||||||
break;
|
break;
|
||||||
case everyNthMonth_4:
|
case everyNthMonth_4:
|
||||||
sprintf(buf, "MD%d #%d ", a4->period.nth, duration);
|
snprintf(buf, sizeof buf, "MD%d #%d ", a4->period.nth, duration);
|
||||||
break;
|
break;
|
||||||
case monThruFri_4:
|
case monThruFri_4:
|
||||||
sprintf(buf, "W1 MO TU WE TH FR #%d ", duration);
|
snprintf(buf, sizeof buf, "W1 MO TU WE TH FR #%d ", duration);
|
||||||
break;
|
break;
|
||||||
case monWedFri_4:
|
case monWedFri_4:
|
||||||
sprintf(buf, "W1 MO WE FR #%d ", duration);
|
snprintf(buf, sizeof buf, "W1 MO WE FR #%d ", duration);
|
||||||
break;
|
break;
|
||||||
case tueThur_4:
|
case tueThur_4:
|
||||||
sprintf(buf, "W1 TU TH #%d ", duration);
|
snprintf(buf, sizeof buf, "W1 TU TH #%d ", duration);
|
||||||
break;
|
break;
|
||||||
case daysOfWeek_4:
|
case daysOfWeek_4:
|
||||||
sprintf(buf, "W1 #%d ", duration);
|
snprintf(buf, sizeof buf, "W1 #%d ", duration);
|
||||||
|
/* XXX strcat is unsafe here */
|
||||||
if (a4->period.nth & 0x1) strcat(buf, "SU ");
|
if (a4->period.nth & 0x1) strcat(buf, "SU ");
|
||||||
if (a4->period.nth & 0x2) strcat(buf, "MO ");
|
if (a4->period.nth & 0x2) strcat(buf, "MO ");
|
||||||
if (a4->period.nth & 0x4) strcat(buf, "TU ");
|
if (a4->period.nth & 0x4) strcat(buf, "TU ");
|
||||||
|
|
|
@ -44,7 +44,7 @@ set_timezone(char *tzname)
|
||||||
if (tzname==NULL)
|
if (tzname==NULL)
|
||||||
system("unset TZ\n");
|
system("unset TZ\n");
|
||||||
else {
|
else {
|
||||||
sprintf(tzenv, "TZ=%s", tzname);
|
snprintf(tzenv, sizeof tzenv, "TZ=%s", tzname);
|
||||||
(void) putenv(tzenv);
|
(void) putenv(tzenv);
|
||||||
tzset();
|
tzset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ _DtCmIsSameUser(char *user1, char *user2)
|
||||||
/* assume user2=user@host[.domain] */
|
/* assume user2=user@host[.domain] */
|
||||||
if (str1 == NULL) {
|
if (str1 == NULL) {
|
||||||
str1 = strchr(user1, '@');
|
str1 = strchr(user1, '@');
|
||||||
sprintf(buf, "%s.%s", ++str1, domain);
|
snprintf(buf, sizeof buf, "%s.%s", ++str1, domain);
|
||||||
str1 = buf;
|
str1 = buf;
|
||||||
} else {
|
} else {
|
||||||
str1 = strchr(user1, '@');
|
str1 = strchr(user1, '@');
|
||||||
|
|
|
@ -115,7 +115,7 @@ _DtCmGetLocalDomain(char *hostname)
|
||||||
ptr = domain;
|
ptr = domain;
|
||||||
if (hostname == NULL) hostname = _DtCmGetLocalHost();
|
if (hostname == NULL) hostname = _DtCmGetLocalHost();
|
||||||
while (1) {
|
while (1) {
|
||||||
sprintf(buf, "%s.%s", hostname, ptr);
|
snprintf(buf, sizeof buf, "%s.%s", hostname, ptr);
|
||||||
if ((cl = clnt_create(buf, 100068, 5, "udp")) == NULL) {
|
if ((cl = clnt_create(buf, 100068, 5, "udp")) == NULL) {
|
||||||
ptr = strchr(ptr, '.');
|
ptr = strchr(ptr, '.');
|
||||||
if (ptr)
|
if (ptr)
|
||||||
|
@ -145,9 +145,10 @@ _DtCmGetHostAtDomain()
|
||||||
|
|
||||||
host = _DtCmGetLocalHost();
|
host = _DtCmGetLocalHost();
|
||||||
if (strchr(host, '.') == NULL)
|
if (strchr(host, '.') == NULL)
|
||||||
sprintf(hostname, "%s.%s", host,
|
snprintf(hostname, BUFSIZ, "%s.%s", host,
|
||||||
_DtCmGetLocalDomain(host));
|
_DtCmGetLocalDomain(host));
|
||||||
else
|
else
|
||||||
|
/* XXX strcpy unsafe here */
|
||||||
strcpy(hostname, host);
|
strcpy(hostname, host);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1451,7 +1451,7 @@ _GetV4UserAccess(Calendar *cal, cms_access_entry *alist)
|
||||||
return (CSA_SUCCESS);
|
return (CSA_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(buf, "%s@%s", user, localhost);
|
snprintf(buf, sizeof buf, "%s@%s", user, localhost);
|
||||||
for (; alist != NULL; alist = alist->next) {
|
for (; alist != NULL; alist = alist->next) {
|
||||||
if (strcasecmp(alist->user, "world") == 0)
|
if (strcasecmp(alist->user, "world") == 0)
|
||||||
worldaccess = alist->rights;
|
worldaccess = alist->rights;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue