Invalidate dcons buffer address if the magic is wrong.
This commit is contained in:
parent
69560edc13
commit
00fab05d23
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=135821
@ -327,6 +327,7 @@ dconschat_get_ptr (struct dcons_state *dc) {
|
|||||||
int dlen, i;
|
int dlen, i;
|
||||||
u_int32_t ptr[DCONS_NPORT*2+1];
|
u_int32_t ptr[DCONS_NPORT*2+1];
|
||||||
static int retry = RETRY;
|
static int retry = RETRY;
|
||||||
|
char ebuf[64];
|
||||||
|
|
||||||
again:
|
again:
|
||||||
dlen = dread(dc, &ptr, sizeof(ptr),
|
dlen = dread(dc, &ptr, sizeof(ptr),
|
||||||
@ -340,7 +341,10 @@ dconschat_get_ptr (struct dcons_state *dc) {
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
if (ptr[0] != htonl(DCONS_MAGIC)) {
|
if (ptr[0] != htonl(DCONS_MAGIC)) {
|
||||||
dconschat_ready(dc, 0, "wrong magic");
|
if ((dc->flags & F_USE_CROM) !=0)
|
||||||
|
dc->paddr = 0;
|
||||||
|
snprintf(ebuf, sizeof(ebuf), "wrong magic 0x%08x", ptr[0]);
|
||||||
|
dconschat_ready(dc, 0, ebuf);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
retry = RETRY;
|
retry = RETRY;
|
||||||
|
Loading…
Reference in New Issue
Block a user